@@ -158,22 +158,26 @@ influence global behavior, like `--verbose`, `--silent`, or `--dry-run`.
158158
159159At this point a few things are worth calling out.
160160
161- - We support both ` --flag ARG ` and ` --flag=<arg> ` format in the flag
162- specification, and accept both the version with and without a ` = ` when
163- invoking, regardless of which version is used to define the flag.
161+ - To specifiy arguments to flags or subcommands we support both the all-caps
162+ version or the angle brackets, version, so ` --flag ARG ` or ` --flag <arg> ` .
163+ - You can optionally add an equal sign in between when specifying the argument,
164+ e.g. ` --flag=<arg> ` .
165+ - When invoking the command, both the version with or without ` = ` are
166+ understood, regardless of how the flag was specified.
164167- If a flag is not predefined then only the ` --flag=<arg> ` version is able to
165- pass along an argument, with ` --flag arg ` we assume that arg is a plain
166- positional argument.
168+ pass along an argument, with ` --flag arg ` we assume that flag does not take
169+ any arguments, and arg is instead treated as a positional argument to the
170+ (sub-)command.
167171- For flags without arguments, the default behavior is to count the number of
168172 flags. This is useful for things like ` --verbose ` that can be specified
169173 multiple times. For other cases you can simply treat it as a boolean.
170- - The key that is used in the options map is based on the long-form
174+ - The key that is used in the options map is based on the long-form.
171175 (double-dash) form. So ` -v, --verbose ` means you'll get a ` :verbose ` key, for
172- ` -v ` or ` --verbose `
176+ ` -v ` or ` --verbose ` .
173177- You can use the ` --[no-]foo ` syntax for adding both a ` --foo ` and a ` --no-foo `
174178 flag, in this case the resulting value in the opts map will be ` :foo true ` or
175- ` :foo false `
176- - You can add a ` :default ` to a flag, like ` ["--port PORT" {:default 8080}] `
179+ ` :foo false ` .
180+ - You can add a ` :default ` to a flag, like ` ["--port PORT" {:default 8080}] ` .
177181- You can set a ` :parse ` function which will be used to parse/coerce the
178182 argument. The default will parse numbers (basic longs and doubles, no special
179183 formats), and nothing else.
@@ -182,7 +186,7 @@ At this point a few things are worth calling out.
182186 the default to a string or a number, this will look better in the help text,
183187 where we show the default.
184188- A single dash (` - ` ) is considered a positional argument, conventially
185- indicating stdin/stdout
189+ indicating stdin/stdout.
186190- To pass a positional argument that starts with a dash, prefix it with a
187191 backslash. lambdaisland/cli will remove the backslash, and treat the remainder
188192 as a positional argument rather than a flag. Note that the shell does its own
0 commit comments