Jeff Backus
318c359efd
Added license to top of argparse.lua.
2015-08-04 21:57:45 -04:00
mpeterv
389d5e0e2e
Limit number of properties that can be set as call arguments
2015-06-20 18:27:32 +03:00
mpeterv
d88c84be57
Add typecheck for 'add_help' property
2015-06-20 18:23:29 +03:00
Kyle McLamb
0fedcdeade
Add handle_options property to Parser
...
When `parser:handle_options(true)` (the default), the parser will behave as
before.
When `parser:handle_options(false)`, all options will be passed verbatim
to the argument list, as if the input included double-hyphens.
2015-06-17 04:06:41 -04:00
mpeterv
85809c8ad4
Reorder properties
...
Move more common properties to the front of property lists,
so that they can be passed as constructor arguments.
E.g.
parser:option "-p" "--port"
:description "Port number."
:default "8080"
:convert(tonumber)
can now be expressed as
parser:option("-p --port", "Port number.", "8080", tonumber)
2015-06-09 22:27:32 +03:00
mpeterv
44fd3b3cb8
Remove 'aliases' property
...
Allow setting several names using 'name' property instead, e.g.
':name "-f --foo"' instead of ':aliases {"-f", "--foo"}'.
This change breaks documented interface of 0.3.x.
2015-06-09 22:08:16 +03:00
mpeterv
ff9abac990
Allow using multiple constructor arguments for configuring elements
...
Disable undocumented ability to specify aliases as arguments
for constructors, e.g. parser:option("-f", "--foo"), and instead
order properties and pass constructor arguments to them.
E.g. parser:argument("foo", "A foo that bars") sets argument
name to foo and description to "A foo that bars".
TODO: remove "aliases" property, instead allow setting several
names in one string by separating them using space.
TODO: reorder properties so that most useful ones could be used
as constructor arguments.
2015-06-09 21:56:36 +03:00
mpeterv
476ad19de8
Avoid printing space at the end of line
2015-03-13 15:40:24 +03:00
mpeterv
0da90dc597
Print \n instead of \r\n
2015-03-13 15:12:06 +03:00
mpeterv
dcb17aa8b0
Remove bundled 30log
2015-01-15 16:25:00 +03:00
mpeterv
150fa8e75c
Fixed some luacheck warnings
2015-01-15 15:44:41 +03:00
mpeterv
1e940eac8b
Bundle 30log
...
Be compatible with old Luarocks versions, including Luarocks installed
via apt-get and Lua for Windows.
2014-11-06 16:22:49 +03:00
mpeterv
bd5fd00e6c
Custom target should not affect usage and help message generation
2014-08-25 13:51:08 +04:00
mpeterv
b02536d6ba
Fixed - being replaced with _ in custom targets
...
Default argname for options is now default target in brackets
2014-08-25 13:44:26 +04:00
mpeterv
6e02b89b9b
Replace - with _ in default target
2014-08-23 11:35:49 +04:00
mpeterv
b8766c8cdf
Improved usage message generation
...
Put options taking variable number of arguments after positional arguments
2014-08-21 15:24:54 +04:00
mpeterv
8c16eca398
Revert autoadding of <> to custom argnames
2014-08-06 13:33:50 +04:00
mpeterv
4b97d03bf5
Added show_default field
2014-08-06 13:02:29 +04:00
Peter Melnichenko
193d448421
Merge pull request #1 from stepelu/fix
...
Compatibility with strict.lua and other checkers.
2014-08-01 17:52:18 +04:00
mpeterv
59603d5f39
Fixed exploded tests to work with busted 2.0
2014-08-01 17:44:15 +04:00
Stefano Peluchetti
e8b20d9bfc
Compatibility with strict.lua and other checkers.
2014-08-01 18:38:58 +09:00
mpeterv
d1386c1d96
Add brackets to argname automatically
...
Updated aux files
2014-04-24 21:27:22 +04:00
mpeterv
7bf5777413
Added mutually exclusive groups
2014-03-09 14:28:55 +04:00
mpeterv
fae3fb4500
Lua 5.0 compatibility flag strikes again
2014-03-09 13:23:11 +04:00
mpeterv
413199c54c
An attempt to fix a problem with Lua 5.1
2014-03-09 12:40:14 +04:00
mpeterv
c605f248ad
Better name inference
2014-03-08 16:25:54 +04:00
mpeterv
2d0faa258d
Argname can be an array
2014-03-08 16:04:40 +04:00
mpeterv
2c7e655932
Refactoring: made help and usage generation clearer
2014-03-08 15:04:47 +04:00
mpeterv
b4c51e84de
Make add_help an actual field
2014-03-02 19:27:37 +04:00
mpeterv
fb1c14ff80
Fixed options receiving arguments after --
2014-03-02 12:40:16 +04:00
mpeterv
454ef54aa3
Removed :usage() hooks for arguments and options
2014-03-02 11:51:25 +04:00
mpeterv
07a045d04a
Fixed Lua 5.1 incompatibility
2014-03-02 02:34:20 +04:00
mpeterv
9441804c3f
Minor refactoring
2014-03-02 02:10:46 +04:00
mpeterv
f24cfe9627
Got rid of :prepare()
2014-03-02 02:03:44 +04:00
mpeterv
085f152127
Refactoring - removed :prepare calls for elements
2014-03-02 01:28:31 +04:00
mpeterv
db3e21e944
Refactoring: added sanity checks in setters
2014-03-02 00:49:44 +04:00
mpeterv
73467e2836
Fixed usage messages in subcommands corrupted after several usages
2014-03-01 16:41:14 +04:00
mpeterv
8cefeb1ef7
Updated README; use u
in defmode
as a flag instead of c
2014-03-01 15:05:36 +04:00
mpeterv
d601f54dce
Improved usage messages for default values
2014-03-01 14:43:20 +04:00
mpeterv
57f8d46ba3
Reworked default values
...
* Better out-of-the-box behavior: commonly used feature should work without configuration. Only use default value if argument/option was not used at all.
* Add `defmode` field so that old behaviour can be used, too.
2014-02-28 17:06:07 +04:00
mpeterv
a4b93b0833
Changed actions behaviour
...
Actions are now just triggers. Actions for arguments and root parser ae removed.
2014-02-26 12:07:53 +04:00
mpeterv
aeacbeb589
Improved error message
...
Report '1 times' as '1 time'
2014-02-23 16:58:39 +04:00
mpeterv
5c82cb4c2e
Added epilog field
2014-02-23 16:44:13 +04:00
mpeterv
7994dded7e
Make command required by default
2014-02-23 16:27:23 +04:00
mpeterv
fc65c85a13
Improved command line parsing
...
The first character after control character is now not required to be a letter
2014-02-23 16:20:55 +04:00
mpeterv
d9fc8728ca
Mark entire option as optional if there is default value
2014-02-20 12:52:24 +04:00
mpeterv
3e6dc54201
If an option with a default value is underused, invoke it more
2014-02-20 12:48:51 +04:00
mpeterv
e99e047c4d
In usage message, mark arguments as optional if there is a default value
2014-02-20 12:41:27 +04:00
mpeterv
8bc02caae6
Convert can now be a table used as mapping
2014-02-20 12:34:02 +04:00
mpeterv
754788b986
False return from converter is now valid, only nil is signal for error
2014-02-20 12:28:46 +04:00