docs: standardise on definition lists for options

Harmonizes the option listing including formatting in a similar manner to the
synopsis of each entry.
This commit is contained in:
David Adam
2022-03-11 23:56:20 +08:00
parent cf85bf9be3
commit e23e52a8e9
30 changed files with 470 additions and 240 deletions

View File

@@ -25,22 +25,28 @@ The variables will be set with local scope (i.e., as if the script had done ``se
Options
-------
The following ``argparse`` options are available. They must appear before all OPTION_SPECs:
The following ``argparse`` options are available. They must appear before all *OPTION_SPEC*\ s:
**-n** or **--name**
the command name for use in error messages. By default the current function name will be used, or ``argparse`` if run outside of a function.
The command name for use in error messages. By default the current function name will be used, or ``argparse`` if run outside of a function.
**-x** or **--exclusive** should be followed by a comma separated list of short or long options that are mutually exclusive. You can use this more than once to define multiple sets of mutually exclusive options.
**-x** or **--exclusive** *OPTIONS*
A comma separated list of options that are mutually exclusive. You can use this more than once to define multiple sets of mutually exclusive options.
- **-N** or **--min-args** is followed by an integer that defines the minimum number of acceptable non-option arguments. The default is zero.
**-N** or **--min-args** *NUMBER*
The minimum number of acceptable non-option arguments. The default is zero.
- **-X** or **--max-args** is followed by an integer that defines the maximum number of acceptable non-option arguments. The default is infinity.
**-X** or **--max-args** *NUMBER*
The maximum number of acceptable non-option arguments. The default is infinity.
- **-i** or **--ignore-unknown** ignores unknown options, keeping them and their arguments in $argv instead.
**-i** or **--ignore-unknown**
Ignores unknown options, keeping them and their arguments in $argv instead.
- **-s** or **--stop-nonopt** causes scanning the arguments to stop as soon as the first non-option argument is seen. Among other things, this is useful to implement subcommands that have their own options.
**-s** or **--stop-nonopt**
Causes scanning the arguments to stop as soon as the first non-option argument is seen. Among other things, this is useful to implement subcommands that have their own options.
- **-h** or **--help** displays help about using this command.
**-h** or **--help**
Displays help about using this command.
.. _cmd-argparse-usage:
@@ -159,7 +165,7 @@ Fish ships with a ``_validate_int`` function that accepts a ``--min`` and ``--ma
Example OPTION_SPECs
--------------------
Some OPTION_SPEC examples:
Some *OPTION_SPEC* examples:
- ``h/help`` means that both ``-h`` and ``--help`` are valid. The flag is a boolean and can be used more than once. If either flag is used then ``_flag_h`` and ``_flag_help`` will be set to the count of how many times either flag was seen.