diff --git a/README.md b/README.md index f6d2314..1dae6aa 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ $ lua script.lua foo bar ``` ``` -Usage: script [-o ] [-I ] [-h] +Usage: script [-h] [-o ] [-I ] Error: too many arguments ``` @@ -74,7 +74,7 @@ $ lua script.lua --help ``` ``` -Usage: script [-o ] [-I ] [-h] +Usage: script [-h] [-o ] [-I ] An example. @@ -82,11 +82,11 @@ Arguments: input Input file. Options: + -h, --help Show this help message and exit. -o , --output Output file. (default: a.out) -I , --include Include locations. - -h, --help Show this help message and exit. ``` ```bash @@ -94,7 +94,7 @@ $ lua script.lua foo --outptu=bar ``` ``` -Usage: script [-o ] [-I ] [-h] +Usage: script [-h] [-o ] [-I ] Error: unknown option '--outptu' Did you mean '--output'? diff --git a/docsrc/callbacks.rst b/docsrc/callbacks.rst index d618483..17ea8a2 100644 --- a/docsrc/callbacks.rst +++ b/docsrc/callbacks.rst @@ -31,7 +31,7 @@ argparse can perform automatic validation and conversion on arguments. If ``conv .. code-block:: none - Usage: script.lua [-t ] [-h] + Usage: script.lua [-h] [-t ] Error: nonexistent.txt: No such file or directory @@ -41,7 +41,7 @@ argparse can perform automatic validation and conversion on arguments. If ``conv .. code-block:: none - Usage: script.lua [-t ] [-h] + Usage: script.lua [-h] [-t ] Error: malformed argument 'many' diff --git a/docsrc/commands.rst b/docsrc/commands.rst index 2d48153..0193c4f 100644 --- a/docsrc/commands.rst +++ b/docsrc/commands.rst @@ -91,7 +91,7 @@ Commands have their own usage and help messages. .. code-block:: none - Usage: script.lua install [-f ] [-h] + Usage: script.lua install [-h] [-f ] Error: too few arguments @@ -101,14 +101,14 @@ Commands have their own usage and help messages. .. code-block:: none - Usage: script.lua install [-f ] [-h] + Usage: script.lua install [-h] [-f ] Arguments: rock Options: - -f , --from -h, --help Show this help message and exit. + -f , --from Making a command optional ------------------------- diff --git a/docsrc/defaults.rst b/docsrc/defaults.rst index 64bfb13..0d4c96d 100644 --- a/docsrc/defaults.rst +++ b/docsrc/defaults.rst @@ -30,12 +30,12 @@ The existence of a default value is reflected in help message, unless ``show_def .. code-block:: none - Usage: script.lua [-o ] [-h] + Usage: script.lua [-h] [-o ] Options: + -h, --help Show this help message and exit. -o , --output Output file. (default: a.out) - -h, --help Show this help message and exit. Note that invocation without required arguments is still an error. @@ -45,7 +45,7 @@ Note that invocation without required arguments is still an error. .. code-block:: none - Usage: script.lua [-o ] [-h] + Usage: script.lua [-h] [-o ] Error: too few arguments @@ -76,12 +76,12 @@ Consider the difference: .. code-block:: none - Usage: script.lua [-o ] [-p [

]] [-h] + Usage: script.lua [-h] [-o ] [-p [

]] Options: + -h, --help Show this help message and exit. -o default: a.out -p [

] default: password - -h, --help Show this help message and exit. .. code-block:: none @@ -111,6 +111,6 @@ Consider the difference: .. code-block:: none - Usage: script.lua [-o ] [-p [

]] [-h] + Usage: script.lua [-h] [-o ] [-p [

]] Error: too few arguments diff --git a/docsrc/messages.rst b/docsrc/messages.rst index 6804e18..b829c69 100644 --- a/docsrc/messages.rst +++ b/docsrc/messages.rst @@ -23,11 +23,11 @@ it is not included into help and usage messages, but otherwise works normally. .. code-block:: none - Usage: script.lua [--normal-option ] [-h] + Usage: script.lua [-h] [--normal-option ] Options: - --normal-option -h, --help Show this help message and exit. + --normal-option .. code-block:: none @@ -57,11 +57,11 @@ For options and arguments, ``argname`` property controls the placeholder for the .. code-block:: none - Usage: script.lua [-f ] [-h] + Usage: script.lua [-h] [-f ] Options: - -f , --from -h, --help Show this help message and exit. + -f , --from ``argname`` can be an array of placeholders. @@ -78,11 +78,11 @@ For options and arguments, ``argname`` property controls the placeholder for the .. code-block:: none - Usage: script.lua [--pair ] [-h] + Usage: script.lua [-h] [--pair ] Options: - --pair -h, --help Show this help message and exit. + --pair Grouping elements ----------------- @@ -113,9 +113,9 @@ a named group with its own section in the help message. Elements outside any gro .. code-block:: none - Usage: script.lua [-v] [--use-colors] [--encoding ] + Usage: script.lua [-h] [-v] [--use-colors] [--encoding ] [--compression-level ] - [--skip-broken-chunks] [--version] [-h] + [--skip-broken-chunks] [--version] Configuring output format: -v, --verbose @@ -127,8 +127,8 @@ a named group with its own section in the help message. Elements outside any gro --skip-broken-chunks Other options: - --version -h, --help Show this help message and exit. + --version Help message line wrapping -------------------------- @@ -167,9 +167,10 @@ and the continuation lines are aligned with the first word after the list item m .. code-block:: none - Usage: script.lua [-f ] [-b ] [-h] + Usage: script.lua [-h] [-f ] [-b ] Options: + -h, --help Show this help message and exit. -f , Lorem ipsum dolor sit amet, consectetur adipiscing --foo elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis @@ -188,7 +189,6 @@ and the continuation lines are aligned with the first word after the list item m ullamco laboris nisi ut aliquip... * Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. - -h, --help Show this help message and exit. ``help_max_width`` property is inherited by commands. @@ -221,8 +221,8 @@ Like ``help_max_width``, all of them are inherited by commands when set on the p .. code-block:: none - Usage: script.lua [--foo ] [--bar ] - [--baz ] [--qux ] [-h] + Usage: script.lua [-h] [--foo ] [--bar ] + [--baz ] [--qux ] Help message for a group of arguments, options, or commands is organized into two columns, with usage template on the left side and descriptions on the right side. @@ -250,11 +250,13 @@ within a group (``0`` by default). .. code-block:: none - Usage: script.lua [--foo ] [--bar ] [--baz ] - [--qux ] [-h] + Usage: script.lua [-h] [--foo ] [--bar ] [--baz ] + [--qux ] Options: + -h, --help Show this help message and exit. + --foo Set foo. --bar Set bar. @@ -262,5 +264,3 @@ within a group (``0`` by default). --baz Set baz. --qux Set qux. - - -h, --help Show this help message and exit. diff --git a/docsrc/misc.rst b/docsrc/misc.rst index 5a0d1be..d77b25d 100644 --- a/docsrc/misc.rst +++ b/docsrc/misc.rst @@ -127,7 +127,7 @@ Set ``overwrite`` property to ``false`` to prohibit this behavior. .. code-block:: none - Usage: script.lua [-o ] [-h] + Usage: script.lua [-h] [-o ] Error: option '-o' must be used at most 1 time