A feature-rich command-line argument parser for Lua supporting required/optional arguments, flags, commands, and automatic help generation.
lua_cliargs is a command-line argument parsing module for Lua. It provides a structured way to define and parse arguments, options, and flags for CLI applications, handling validation, help generation, and subcommands. It solves the problem of manually processing `arg` tables in Lua scripts, making CLI development more maintainable and user-friendly.
Lua developers building command-line tools, scripts, or applications that require robust argument handling, such as system utilities, build tools, or automation scripts.
Developers choose lua_cliargs for its comprehensive feature set—including support for commands, flexible notation, and automatic help—coupled with Lua's simplicity. It's a mature, well-tested library that reduces boilerplate and enforces consistency in CLI interfaces.
A command-line argument parsing module for Lua.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports options anywhere in the command line (unless terminated with --) and multiple notations like -short VALUE or --key=VALUE, as described in the 3.0 changes for more flexible parsing.
Generates formatted help listings via --help or cli:print_help(), with clear argument and option descriptions, reducing boilerplate for documentation.
Enables Git-style subcommands with custom handlers, allowing complex CLI applications, as demonstrated in examples like 04_commands--git.lua.
Detects missing required arguments, unknown options, and incorrect usage, providing user-friendly error messages that prompt re-running with --help.
Offers cli:load_defaults() to inject runtime configuration from files, facilitating defaults management without manual parsing.
Major versions like 3.0 introduce breaking changes requiring code updates, as noted in the changelog and UPGRADE guide, which can disrupt maintenance.
Command support is described as 'basic' in the README, potentially lacking features for deeply nested or complex command hierarchies compared to more advanced libraries.
Reading configuration files via cli:read_defaults() requires additional libraries to be installed, adding setup complexity and potential dependency management issues.