Usage:
program defintion
Options:
<this area>
- short option
- ✓
-o
- ✓
-o ARG
- ✓
-o <arg>
- ✓
-o ARG...
- ✓
-o <arg>...
- ✓
- long option
- ✓
--option
- ✓
--option ARG
- ✓
--option=ARG
- ✓
--option <arg>
- ✓
--option=<arg>
- ✓
--option ARG...
- ✓
--option <arg>...
- ✓
--option=ARG...
- ✓
--option=<arg>...
- ✓
- option with default value
- ✓
[default: value]
- ✓
Option description. [default: value]
- ✓
- comma between short and long options
- ✓
-o, --option
- ✓
-o ARG, --option
- ✓
-o <arg>, --option
- ✓
-o ARG..., --option
- ✓
-o <arg>..., --option
- ✓
- not necessary to define
ARG
/<arg>
for both short and long option- ✓
-o ARG --option
- ✓
-o --option ARG
- ✓
-o ARG... --option
- ✓
-o --option ARG...
- ✓
Usage:
<this area>
Options:
options definition
- short option
- ✓
-o
- ✓
-o ARG
- ✓
-o <arg>
- ✗
-o WRONG_ARG
throw error if there is mismatch in naming of arguments declared in options area. - ✓
-o
withoutARG
but it is declared in options that it takes an argument. - ✓
-v...
continous option. - ✓
-o ARG...
- ✓
-o <arg>...
- ✗
-v...
throw error if it declared in options that it takes an argument. - ✓
-abc
consecutive short options with a single dash .
- ✓
- long option
- ✓
--option
- ✓
--option ARG
- ✓
--option=ARG
- ✓
--option <arg>
- ✓
--option=<arg>
- ✓
--option
withoutARG
it is declared in options that it takes an argument. - ✗
--option WRONG_ARG
throw error if there is mismatch in naming of arguments declared in options area. - ✓
--verbose...
continous option - ✓
--option ARG...
- ✓
--option=ARG...
- ✓
--option <arg>...
- ✓
--option=<arg>...
- ✗
--verbose...
throw error if it declared in options that it takes an argument.
- ✓
- optional options
- ✓
[-o]
- ✓
[-o ARG]
- ✓
[-o ARG...]
- ✓
[-o <arg>]
- ✓
[--option]
- ✓
[--option ARG]
- ✓
[--option=ARG]
- ✓
[--option <arg>]
- ✓
[--option=<arg>]
- ✓
[-o <arg>...]
- ✓
[--option ARG...]
- ✓
[--option=ARG...]
- ✓
[--option <arg>...]
- ✓
[--option=<arg>...]
- ✓
[options]
special "all options" allowed in no particular order.
- ✓
- commands
- ✓
command
- ✓
command...
- ✓
[command]
optional command. - ✓
[command...]
optional continous command.
- ✓
- positional argument
- ✓
ARG
- ✓
ARG...
continous argument resolves to multiple values. - ✓
ARG ARG...
singular and plural definition resolves to multiple values.
- ✓
- multiple optionals
- ✓
[--input --output]
multiple long options inside a single pair of brackets. - ✓
[-i -o]
multiple short options inside a single pair of brackets. - ✓
[-io]
consecutiave short options. - ✓
[FILE1 FILE2]
positional arguments.
- ✓
- grouping
- ✓
--option1 | --option2 | --option3 ...
- ✓
command1 | command2 | command3 ...
- ✓
(--input --ouput | --in --out)
multiple required pairs
- ✓
declare -A ARGS=(
...this area
)
_docopt ()(...)
- short option
- ✓
-o
short option without long counterpart resolves to short name with-
prefix. - ✓ Defaults to false when no argument is declared.
- ✓ Defatuls to empty
-o=
when argument is declared without a default. - ✓
[-i FILE] [default: -]
Defaults declared default value.
- ✓
- long option
- ✓
--option
long option resolves to name with--
prefix. - ✓ Defaults to false.
- ✓ Defatuls to empty
--option=
when argument is declared without a default. - ✓
[--input FILE] [default: -]
Defaults to declared default value.
- ✓
- short and long
- ✓
-o --option
resolves to long name with--
prefix.
- ✓
- command
- ✓
command
Defaults tofalse
on singular value. - ✓
command...
Defaults to0
on continous values.
- ✓
- positional
- ✓
ARG
Defaults to emptyARG=
on singular value. - ✓
ARG...
Defaults to emptyARG=
on continous values.
- ✓
$ program <this area>
- ✓ empty program
- option
- ✓
--option
match required without argument. - ✓
--option=ARG
match required with argument. - ✓
--
match provided optional wihout argument. - ✓ match provided optional with argument.
- ✓ match non-provided optional wihout argument.
- ✓ match non-provided optional with argument.
- ✗ error on non-exiting option.
- ✓
- command
- ✓ match required singular.
- ✓ match required continous.
- ✓ match provided optional singular.
- ✓ match provided optional continous.
- ✓ match non-provided optional singular.
- ✓ match non-provided optional continous.
- ✗ error on non-exiting command.
- positional
- ✓
ARG
match required singular. - ✓
ARG...
match required continous. - ✓
[ARG]
match provided optional singular. - ✓
[ARG...]
match provided optional continous. - ✓
[ARG]
match non-provided optional singular. - ✓
[ARG...]
match non-provided optional continous. - ✗ error when required not met.
- ✓