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
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 aliases | +Location of option's arguments | +
---|---|
-o |
+args.o |
+
-o --output |
+args.output |
+
-s --from-server |
+args.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.
The value of description
field of a parser is placed between the usage message and the argument list in the help message.
For options and arguments, argname
field controls the placeholder for the argument in the usage message.
(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.
+
+