Skip to content

Commit

Permalink
Improve the description about nargs=?,N
Browse files Browse the repository at this point in the history
Squashed, slightly modified version of PRs from @petershintech.
Closes #112, #113
  • Loading branch information
carlobaldassi committed Feb 8, 2024
1 parent e2bfc9d commit cae97b4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions docs/src/arg_table.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,12 @@ The `nargs` setting can be a number or a character; the possible values are:
using an explicit `1` because the result is not stored in a `Vector`).
* `0`: this is the only possibility (besides `'A'`) for flag actions, and it means no extra tokens will be parsed from
the command line. If `action` is not specified, setting `nargs` to `0` will make `action` default to `:store_true`.
* a positive integer number `N`: exactly `N` tokens will be parsed from the command-line, and the result stored into a `Vector`
of length `N` (even for `N=1`).
* a positive integer number `N`: exactly `N` tokens will be parsed from the command-line, and stored into a `Vector`
of length `N`. Note that `nargs=1` produces a `Vector` of one item.
* `'?'`: optional, i.e. a token will only be parsed if it does not look like an option (see the [Parsing details](@ref) section
for a discussion of how exactly this is established), otherwise the `constant` argument entry setting will be used instead.
This only makes sense with options.
for a discussion of how exactly this is established). If the option string is not given, the `default` argument value will be
used. If the option string is given but not followed by an option parameter, the `constant` argument value will be used
instead. This only makes sense with options.
* `'*'`: any number, i.e. all subsequent tokens are stored into a `Vector`, up until a token which looks like an option is
encountered, or all tokens are consumed.
* `'+'`: like `'*'`, but at least one token is required.
Expand Down

0 comments on commit cae97b4

Please sign in to comment.