Paul Ouellette
d747e69a55
Zsh completions: complete positional arguments
...
- Completes choices is they exist, otherwise calls _files
- Supports repeated arguments
2019-07-18 16:22:02 -04:00
Paul Ouellette
b7be8cd99a
Zsh completions: complete commands and command options
...
Supports an arbitrary number of nested subcommands.
2019-07-18 16:21:44 -04:00
Paul Ouellette
c2b2a16abe
Zsh completions: Improve option completion
...
- support arguments with choices
- allow invoking an option multiple times
- complete files if an argument is required, but no choices are
specified
2019-07-18 16:21:23 -04:00
Paul Ouellette
c545e49701
Prevent generation of broken completion scripts
2019-07-17 22:04:41 -04:00
Paul Ouellette
56716617a2
Add support for a completion subcommand
2019-07-17 22:04:41 -04:00
Paul Ouellette
0eac53893b
Normalize IFS
2019-07-17 22:04:41 -04:00
Paul Ouellette
3a0e7a2706
Zsh completion improvements
2019-07-01 23:03:49 -04:00
Paul Ouellette
e9ee89eed5
Initial get_zsh_complete with support for options
2019-06-24 18:03:09 -04:00
Paul Ouellette
4f99e3dce0
Add trailing newline to output of complete functions
2019-06-19 14:58:55 -04:00
Paul Ouellette
188fb9d8ac
Use command summaries in completion descriptions
2019-06-18 12:15:56 -04:00
Paul Ouellette
56364ff50f
Use saved help command instead of index
2019-06-18 12:02:24 -04:00
Paul Ouellette
bcce0fcdcf
Small improvements to bash completions
2019-06-18 11:57:03 -04:00
Paul Ouellette
f18902eb4c
Complete options if current word starts with dash
2019-06-18 11:57:03 -04:00
Paul Ouellette
5b733ba50a
Make add_complete a Parser method
2019-06-18 11:57:03 -04:00
Paul Ouellette
03e7daf31f
Bash completions: complete option argument choices
2019-06-18 11:53:58 -04:00
Paul Ouellette
9738045e18
Implement Parser:get_bash_complete
2019-06-18 11:53:58 -04:00
Paul Ouellette
46622e83de
Remove support for disabling completion option
...
It is disabled by default
2019-06-18 11:53:58 -04:00
Paul Ouellette
c96637b1d7
Return completions as a string in get function
2019-06-18 11:53:58 -04:00
Paul Ouellette
8e04dc6eca
Show first sentence of description in option completion
2019-06-18 11:53:58 -04:00
Paul Ouellette
b893c9bad1
Finish fish completion generator
2019-06-18 11:50:28 -04:00
Paul Ouellette
0709c814e7
Implement add_complete and fish option completion
2019-06-18 11:50:28 -04:00
daurnimator
56e0d68fe1
Merge remote-tracking branch 'luarocks/refs/pull/5/head'
2019-06-18 00:08:08 -07:00
Paul Ouellette
b717d7b11c
Add summary command property
2019-06-17 13:21:11 -04:00
Paul Ouellette
4509f8f29d
Make add_help_command a Parser method
2019-06-17 11:11:26 -04:00
Paul Ouellette
a8faa0b092
Show choices in help and usage messages
2019-05-30 13:55:13 -04:00
Paul Ouellette
dcd5162710
Add argument choices
2019-05-30 13:55:13 -04:00
Paul Ouellette
7981df63da
Make error message more consistent
2019-05-26 23:49:38 -04:00
Paul Ouellette
6e3c4d5305
Implement add_help_command parser property
...
Like add_help, but it adds a command instead of a flag.
2019-05-22 21:59:32 -04:00
Paul Ouellette
c5af087ad0
Save index of help option
...
Instead of keeping it at the end of the options list.
2019-05-22 16:41:58 -04:00
Peter Melnichenko
8df87ca3f0
0.6.0 release
2018-04-13 22:04:45 +03:00
Peter Melnichenko
b8c12f50e3
Vertically align list item continuation lines when autowrapping
2018-04-10 16:10:56 +03:00
Peter Melnichenko
849622d8e2
Autowrap parser description and epilog, too
2018-04-08 19:10:46 +03:00
Peter Melnichenko
488a8e59a0
Add help_max_width
property for help description autowrapping.
2018-04-08 19:03:25 +03:00
Peter Melnichenko
8a3faf3a3e
More properties for configuring usage and help messages
...
* `usage_margin`: sets margin for the second and following lines of
usage string.
* `usage_max_width`: sets usage max width for autowrapping.
* `help_usage_margin`: sets margin for element usages in help string.
* `help_description`: sets margin for element descrptions in help string.
2018-04-08 16:00:42 +03:00
Peter Melnichenko
a04899a485
Add help_vertical_space Parser property
...
Sets number of extra newlines to insert between help strings
for different elements within a help group. Inherited by commands.
2018-04-08 15:44:43 +03:00
Peter Melnichenko
46d9182184
Make the module a table with __call metamethod, add .version field
...
There is little reason to use `_VERSION` instead of `version`.
`_VERSION` global is used by Lua itself, but module tables don't
have to worry about namespace clashes.
2018-04-08 15:25:10 +03:00
Peter Melnichenko
621d5d2709
Update copyright year
2018-04-08 15:20:31 +03:00
Peter Melnichenko
8baabbbe23
Split labels for multi-alias options into lines in help string
2018-04-08 15:03:56 +03:00
Peter Melnichenko
dfb012dba0
Add support for grouping elements in help message
2018-04-08 14:03:45 +03:00
Peter Melnichenko
e33a6ed563
Support --
as an option
2018-04-07 23:21:06 +03:00
Peter Melnichenko
4f72bfeb8e
Add hidden
property, unlisting elements from usage and help
2018-04-07 22:09:18 +03:00
Peter Melnichenko
28604e8411
Rework usage message building and support arguments in mutexes
...
Ref #11 .
2018-03-18 23:28:01 +03:00
Peter Melnichenko
aa740c4270
Allow using separate converters for each argument
...
When converting an argument in a position, if there is a function
in the same position in provided converer array, use
it as a converter function.
This allows using an array of functions as the value of `convert` property,
with each function applied to corresponding argument of a multi-argument option.
Ref #14 .
2018-03-17 14:53:12 +03:00
Peter Melnichenko
b9980b645e
Refactor decision making for auto unboxing of single argument elements
2018-03-17 13:37:59 +03:00
Peter Melnichenko
4d06371a07
Fix some line length warnings
2018-03-17 13:34:50 +03:00
Peter Melnichenko
3a43d528c6
Fix whitespace warnings
2018-03-16 17:26:31 +03:00
mpeterv
413d3e32f1
Pass command name to command actions
2015-12-09 14:02:23 +03:00
mpeterv
247ed9e874
New Parser/Command property 'command_target'
...
Allows saving name of used command in a field of result target.
Helpful when command callbacks are stored in a table with names as keys
or when they are in submodules of some namespace.
Example:
local parser = argparse():command_target("command")
-- Add commands...
local args = parser:parse()
require("namespace." .. args.command).run(args)
2015-11-23 15:54:31 +03:00
mpeterv
79952deb42
Respect empty initial value in 'append' and 'concat' actions
2015-10-31 20:02:56 +03:00
mpeterv
6dc13c3d26
Fix option combining
...
Interpret '-f123' as '-f 123' if '-f' option can take an argument,
even when it can be used without one as well.
2015-10-31 20:01:16 +03:00