API
See http://lua-cliargs.netlify.com/ for the API docs.
Validations
Some sanity guards
In the following cases, cliargs
will report an error to you and terminate the running script:
- flag options can not accept a value. For example:
cli:add_flag('-v VERSION')
will return an error - duplicate keys are not allowed: defining two options with the key
--input
will be rejected
Tests
Running test specs is done using busted. You can install it using LuaRocks, and then just call it with the spec
folder:
luarocks install busted
cd /path/to/lua_cliargs/
busted spec
Contributions
If you come across a bug and you’d like to patch it, please fork the repository, commit your patch, and request a pull.
Thanks to
Many thanks to everyone who reported bugs, provided fixes, and added entirely new features:
If I missed you, don’t hesitate to update this file or just email me.
Changelog
3.0-2
- optimized an internal routine responsible for word-wrapping. Thanks to @Tieske, refs GH-47
Changes from 2.5.1 to 2.5.2
- No longer tracking the (legacy) tarballs in git or the luarocks package. Instead, we use the GitHub release tarballs for each version.
Changes in 2.4.0 from 2.3-4
- All arguments now accept a callback that will be invoked when parsing of those arguments was successful
- (POSSIBLY BREAKING) Default value for flags is now
nil
instead offalse
. This will only affect existing behavior if you were explicitly testing unset flags to equalfalse
(i.e.if flag == false then
) as opposed toif flag then
(orif not flag then
). - Minor bugfixes
Changes in 2.2-0 from 2.1-2
- the
=
that separates keys from values in the--expanded-key
notation is no longer mandatory; using either a space or a=
will map the value to the key (e.g.,--compress lzma
is equal to--compress=lzma
)