``` [1]: . . .-- . . . . [2]: |\ /| |-- |\| | | [3]: ' ' ' '-- ' ' '-' [0]: AGPLv3 2025 ``` ## Build ```sh make ``` menu(1) is a single Rust source file with no dependencies, and can be compiled on its own with rustc(1). It's recommended to run the test program: ```sh make test ``` ## Usage ``` menu [file] ``` If `file` is given, menu(1) reads its menu entries from `file` instead of standard input. ## Menu format Input is ignored until menu(1) reads two consecutive newlines (an empty line). This is to provide room for commentary or a shebang (`#!/usr/bin/env menu` is recommended). Following the two newlines, menu(1) will interpret input as a stream of menu entries. A menu entry begins with its text section, which is the section printed to display the menu option. Currently, the text section ends with a newline only, but in later versions the text section will be able to be extended across multiple lines if they are indented - so a newline followed by a character that isn't the horizontal tab. The attributes section follows the text section. The attributes section ends with a single newline. Text including and following a hash in the attributes section will be ignoroed. The command section follows the attributes section. The command section is run as a single argument following the invocation `$ sh -c`, like the C standard library's system(3). Each line in the command section is preceded by a horizontal tab, which is removed from the argument; if a line in the command section is not preceded by a tab, the omission is considered a syntax error (a "naked line") and menu(1) exits unsuccessfully. The command section ends with two consecutive newlines. ## POSIX systems The Makefile and example shell scripts should work fine with POSIX make(1) and sh(1). Other POSIX.1 utilities are used within the limits of the POSIX specification. ytfeed(6) additionally requires python3(1) to be present in the PATH; this should be a Python 3 interpreter. ## Non-POSIX systems Depending on how foreign the system is, some or much work may be required to port menu(1) and its examples.
Languages
Rust
95.3%
Makefile
4.7%