v0.11.0
andrey-zherikov
released this
31 May 10:48
·
135 commits
to master
since this release
Bug fixes
- Subcommand data member was not correctly initialized if command line has no argument for it.
--help
/-h
did not show correct help screen in case of default subcommand.
Enhancements
- MutuallyExclusive and RequiredTogether can be marked as required:
struct T { @RequiredTogether() { string a; string b; } } // Both or no argument is allowed assert(CLI!T.parseArgs!((T t) {})(["-a","a","-b","b"]) == 0); assert(CLI!T.parseArgs!((T t) {})([]) == 0); // Only one argument is not allowed assert(CLI!T.parseArgs!((T t) { assert(false); })(["-a","a"]) != 0); assert(CLI!T.parseArgs!((T t) { assert(false); })(["-b","b"]) != 0);
struct T { @(RequiredTogether().Required()) { string a; string b; } } // Both arguments are allowed assert(CLI!T.parseArgs!((T t) {})(["-a","a","-b","b"]) == 0); // Single argument or no argument is not allowed assert(CLI!T.parseArgs!((T t) { assert(false); })(["-a","a"]) != 0); assert(CLI!T.parseArgs!((T t) { assert(false); })(["-b","b"]) != 0); assert(CLI!T.parseArgs!((T t) { assert(false); })([]) != 0);