diff --git a/doc/index.html b/doc/index.html index 70b8f71..b15f87b 100644 --- a/doc/index.html +++ b/doc/index.html @@ -89,8 +89,9 @@ Configuring usage and help messages
  • Prohibiting overuse of options
  • @@ -302,29 +303,30 @@ optional baz
    from    there
     
    -

    For an option, default index used to store data is the first 'long' alias (an alias starting with two control characters) or just the first alias, without control characters.

    +

    For an option, default index used to store arguments passed to it is the first 'long' alias (an alias starting with two control characters) or just the first alias, without control characters. Hyphens in the default index are replaced with underscores. In the following table it is assumed that local args = parser:parse() have been executed.

    -

    Sometimes it is useful to explicitly set the index using target field to improve readability of help messages.

    + + + + + + + + + + + + + + + + + + + +
    Option's aliasesLocation of option's arguments
    -oargs.o
    -o --outputargs.output
    -s --from-serverargs.from_server
    -
    parser:option "-f" "--from"
    -   :target "server"
    -
    - -
    $ lua script.lua --help
    -
    - -
    Usage: script.lua [-f <server>] [-h]
    -
    -Options: 
    -   -f <server>, --from <server>
    -   -h, --help            Show this help message and exit. 
    -
    - -
    $ lua script.lua --from there
    -
    - -
    server  there
    -
    +

    As with arguments, the index can be explicitly set using target field.

    Flags

    @@ -726,7 +728,7 @@ Options: Configuring usage and help messages

    -Description and epilog

    +Setting description and epilog

    The value of description field of a parser is placed between the usage message and the argument list in the help message.

    @@ -751,7 +753,7 @@ An epilog.

    -Argument placeholder

    +Setting argument placeholder

    For options and arguments, argname field controls the placeholder for the argument in the usage message.

    @@ -786,6 +788,26 @@ Options: -h, --help Show this help message and exit. +

    +Hiding default value

    + +If an option has a default value, argparse will automatically append (default: <value>>) to its usage message. This can be disabled using show_default field: + +
    parser:option "-o" "--output"
    +   :default "a.out"
    +   :show_default(false)
    +
    + +
    $ lua script.lua --help
    +
    + +
    Usage: script [-o <output>] [-h]
    +
    +Options: 
    +   -o <output>, --output <output>
    +   -h, --help            Show this help message and exit. 
    +
    +

    Prohibiting overuse of options