diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2020-02-24 01:31:39 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2020-02-24 01:31:39 -0800 |
| commit | 865092c656af70bd5317513d8e0ed87fdc1c9acd (patch) | |
| tree | c4311c89b75322b4bb9d7f3547ff0534b935d68f /API.md | |
| parent | a8fd1743191bdb0a7453a2d90055e9dcc61a5ece (diff) | |
Major update: instead of defining all the helper functions as static
C-strings prefixed to commands (modified by the Makefile), the helper
functions are now standalone scripts in the helpers/ dir, which gets
added to "$PATH" when running bb.
Diffstat (limited to 'API.md')
| -rw-r--r-- | API.md | 26 |
1 files changed, 13 insertions, 13 deletions
@@ -9,18 +9,18 @@ internal state. ## Helper Functions -- `bb`: used for modifying `bb`'s internal state (see BB Commands). -- `ask`: get user input in a standardized and customizable way. The first - argument is a variable where the value is stored. The second argument is - a prompt. A third optional argument can provide a default value (may be - ignored). -- `ask1`: get a single character of user input. The first argument is a variable - where the input will be stored and the second argument is a prompt. -- `pause`: Display a "press any key to continue" message and wait for a keypress. -- `confirm`: Display a "Is this okay? [y/N]" prompt and exit with failure if - the user does not press 'y'. -- `spin`: Display a spinning icon while a slow command executes in the background. - (e.g. `spin sleep 5`). +- `bbask [-1] [prompt [initial]]`: get user input in a standardized and + customizable way and output it to `STDOUT`. +- `bbcmd <cmd>*`: used for modifying `bb`'s internal state (see BB Commands). +- `bbconfirm [prompt]`: Display a "Is this okay? [y/N]" prompt and exit with + failure if the user does not press 'y'. +- `bbpause`: Display a "press any key to continue" message and wait for a keypress. +- `bbpick [prompt]`: Select one of `NULL`-delimited multiple inputs and print it. +- `bbtargets "$BBCMD" "$@"`: If `$BBCURSOR` is not currently among `$@` (the + selected files), this script prompts the user to ask whether they want to + perform an action on the selected files, or on the cursor. The result is + printed as `cursor` or `selected`. +- `bbunscroll`: Print text to the screen *above* the cursor instead of below it. ## Environment Variables @@ -80,7 +80,7 @@ glob is available in `$BBGLOB`, which can be used in scripts if left unquoted. ## Final Notes -Internally, `bbcmd` writes the commands (NUL terminated) to a file whose path is +Internally, `bbcmd` writes the commands (`NULL` terminated) to a file whose path is in`$BBCMD` and `bb` reads from that file when it resumes. These commands can also be passed to `bb` at startup as command line arugments starting with `+`, and will run immediately. E.g. `bbcmd +'col:n' +'sort:+r' .` will launch `bb` only |
