aurora23391c7
aurora-run: add --help
+52 −0
1 file changed
- M .local/bin/aurora-run +52 −0
| @@ -4,10 +4,62 @@ | |||
| 4 | 4 | # aurora-run -d [opts] dmenu: lines on stdin, the choice on stdout, exit 1 when cancelled | |
| 5 | 5 | # dmenu opts (fuzzel/dmenu spelling): -p/--prompt TEXT, -l/--lines N (0 = input only), --placeholder TEXT, | |
| 6 | 6 | # --password, --index (print the line number instead). Other fuzzel flags (-i, --width, -fn, ...) are ignored. | |
| 7 | + | # Full reference: aurora-run --help | |
| 8 | + | ||
| 9 | + | usage() { | |
| 10 | + | cat <<'EOF' | |
| 11 | + | aurora-run: aurora's runner and a fuzzel/dmenu replacement for scripts (needs aurora running) | |
| 12 | + | ||
| 13 | + | USAGE | |
| 14 | + | aurora-run open the app runner (same as SUPER+R; again = close) | |
| 15 | + | ... | aurora-run -d [OPTIONS] dmenu mode: one item per stdin line, prints the choice | |
| 16 | + | ||
| 17 | + | DMENU OPTIONS | |
| 18 | + | -d, --dmenu dmenu mode | |
| 19 | + | -p, --prompt TEXT label left of the input (shown in the accent colour) | |
| 20 | + | -l, --lines N visible rows (default 10, capped at 15, shrinks to fit); | |
| 21 | + | 0 = no list, just a text box (stdin optional) | |
| 22 | + | --placeholder TEXT dim hint in the empty input | |
| 23 | + | --password mask the input with * (use with --lines=0) | |
| 24 | + | --index print the 0-based line number instead of the text | |
| 25 | + | (-1 when the typed text was used) | |
| 26 | + | -h, --help this help | |
| 27 | + | Both "--opt VALUE" and "--opt=VALUE" work. Other fuzzel flags (-i, -fn, --width, | |
| 28 | + | --cache, ...) are accepted and ignored, so fuzzel/dmenu lines can just be renamed. | |
| 29 | + | ||
| 30 | + | KEYS | |
| 31 | + | type fuzzy filter (case-insensitive; prefix > word start > substring) | |
| 32 | + | Up/Down, Tab/Shift+Tab, move the selection | |
| 33 | + | Ctrl+N/P, Ctrl+J/K | |
| 34 | + | PgUp/PgDn jump a page | |
| 35 | + | Enter print the selected line (or the typed text if nothing matches) | |
| 36 | + | Ctrl+Enter print the typed text, ignoring the selection | |
| 37 | + | Esc / click outside cancel | |
| 38 | + | ||
| 39 | + | EXIT STATUS | |
| 40 | + | 0 something was chosen (printed on stdout, one line) | |
| 41 | + | 1 cancelled: Esc, click outside, another aurora overlay opened, or a newer | |
| 42 | + | aurora-run -d request replaced this one | |
| 43 | + | 2 aurora not running / exited while waiting, or the IPC call failed | |
| 44 | + | ||
| 45 | + | RUNNER MODE (no -d) | |
| 46 | + | apps (+ their desktop actions), aurora commands (panel tabs, wallpaper, clipboard, | |
| 47 | + | overview, power actions, ...) and everything on $PATH, ranked by launch count. | |
| 48 | + | =EXPR calculator, Enter copies the result >CMD run CMD with sh | |
| 49 | + | Ctrl+Enter runs the selection in foot. | |
| 50 | + | ||
| 51 | + | EXAMPLES | |
| 52 | + | choice=$(printf 'Integrated\nHybrid\nNvidia\n' | aurora-run -d -p "GPU mode:") || exit | |
| 53 | + | query=$(aurora-run -d -l 0 -p "search: ") | |
| 54 | + | pass=$(aurora-run -d --password -l 0 --placeholder "Password:") | |
| 55 | + | n=$(ls | aurora-run -d --index) | |
| 56 | + | EOF | |
| 57 | + | } | |
| 7 | 58 | ||
| 8 | 59 | dmenu=0 prompt="" placeholder="" lines="" password=0 index=0 | |
| 9 | 60 | while [ $# -gt 0 ]; do | |
| 10 | 61 | case $1 in | |
| 62 | + | -h | --help) usage; exit 0 ;; | |
| 11 | 63 | -d | --dmenu) dmenu=1 ;; | |
| 12 | 64 | -p | --prompt) prompt=$2; shift ;; | |
| 13 | 65 | --prompt=*) prompt=${1#*=} ;; | |