usage bash
- Usage:
usage bash [-h] [--help] <SCRIPT> [ARGS]… - Source code:
cli/src/cli/shell.rs
Run a script whose usage spec is written in its own comments
Usually reached through the script's shebang: the kernel hands the script and its arguments to usage, which parses them against the #USAGE lines at the top of the file, then runs the script with this shell. Each flag and argument reaches the script as an environment variable named usage_<name>, so --force becomes usage_force and <file> becomes usage_file. A value declared var=#true arrives as one string, joined with shell_words::join() so that an element containing a space stays quoted.
-h and --help print the script's help page rather than this one.
This command's shebang is #!/usr/bin/env -S usage bash, and the program it runs is bash from PATH. USAGECLI_SHELL_BASH names a different one, which is how it is pointed at Git Bash on a Windows machine where bash is the WSL launcher.
Arguments
<SCRIPT>— The script to run; its spec is read from the#USAGEcomments at the top of the file[ARGS]…— Arguments to pass to the scriptAnything
usagedoes not recognise is a value rather than a mistake, which is what lets a shebang script take flags of its own.
Flags
-h— Print the script's help page instead of running it--help— Print the script's help page instead of running it