Edited for clarity

This commit is contained in:
Bruce Hill 2019-02-14 19:43:39 -08:00
parent f9b9404515
commit 69eca0eb16

View File

@ -13,13 +13,13 @@ cd $path && curl -O example.com/file.zip
``` ```
## Usage ## Usage
`arg -f ...`, `arg -flag ...`, or `arg --flag ...`. If `arg` finds the The following forms are accepted: `arg -f ...`, `arg -flag ...`, or `arg --flag
given flag among the rest of the command line arguments, it will print ...`. If `arg` finds the first given flag among the rest of the command line
the flag's value (if any) and exit successfully, otherwise, it will arguments, it will print the flag's value (if any) and exit successfully,
fail (exit status 1). The value may be of the form `--flag=value`, otherwise, it will fail (exit status 1). The value may be of the form
`--flag value`, `-f value`. Single-letter flags will match when grouped `--flag=value`, `--flag value`, `-f value`, or `-f=value`. Single-letter flags
with other single letter flags, but will not have a value, i.e. will match when grouped with other single letter flags, but will not have a
`arg -b -abc foo` will exit successfully without printing anything. value, i.e. `arg -b -abc foo` will exit successfully without printing anything.
When using `arg` in a shell script, it is best to use quotes around `$@`, When using `arg` in a shell script, it is best to use quotes around `$@`, as in
as in `arg --foo "$@"`, so arguments with spaces will parse properly, `arg --foo "$@"`, so arguments with spaces will parse properly, like
like `my_script.sh --flag "one two"`. `my_script.sh --flag "one two"`.