v0.6.0
What's New
- Added new
Arg.setValuePlaceholder()
to display option's value placeholder in help message. For e.x.:-t, --time=<SECS>
. - Added new
.help_on_empty_args
property for a command which, when set, a help message is automatically displayed when arguments are not provided.
Before:
if (!matches.containsArgs()) {
try app.displayHelp();
return;
}
if (matches.subcommandMatches("update")) |update_cmd_matches| {
if (!update_cmd_matches.containsArgs()) {
try app.displaySubcommandHelp();
return;
}
}
After:
var app = App.init(allocator, "myls", "My custom ls");
defer app.deinit();
var myls = app.rootCommand();
myls.setProperty(.help_on_empty_args);
var update_cmd = app.createCommand("update", "Update the app or check for new updates");
update_cmd.setProperty(.help_on_empty_args);
try myls.addSubcommand(update_cmd);
const matches = try myls.parseProcess();
// --snip--
Note that App.displayHelp()
and App.displaySubcommandHelp()
are still available.
- Improved error messages.
- Polished help message.
What's Changed
App.parseProcess()
andApp.parseFrom()
now returnsArgMatches
directly instead of*const ArgMatches
.- Add
const
qualifier inCommand.addArgs
andCommand.addSubcommands
. By @monomycelium in #21 - Fix:
Arg.multiValuesOption
behavior when single value is provided by @fardragon in #26 - Fix: compiler crash during
zig build test
by @fardragon in 8f53fcb - Fix: subcommands with no values will never match #23. With this change,
ArgMatches.subcommandMatches()
now returns empty matches for any subcommand that doesn't take argument. - Fix: disable printing error messages during test.
Internal Improvements
- The parser implementation has been polished to make it easier to contribute by adding inline comments where necessary.
- Error handling has been enhanced.
- Improved the help message writer's implementation.
- Overall documentation is improved.
New Contributors
- @monomycelium made their first contribution in #21
- @fardragon made their first contribution in #26
Full Changelog: v0.5.1...v0.6.0