Open
Description
/++ dub.json: {
"name": "test-mutually-exclusive",
"dependencies": { "argparse": "~master" }
}
+/
import argparse;
struct Arguments {
@MutuallyExclusive() {
@PositionalArgument(0) string files;
@NamedArgument bool list;
}
}
mixin CLI!Arguments.main!((args) {
return 0;
});
Result:
% dub --single test.d -- --list
Running test-mutually-exclusive --list
Error: The following argument is required: 'files'
Likewise, --help
:
% dub -q --single test.d -- --help
Usage: test-mutually-exclusive [--list] [-h] files
Required arguments:
files
Optional arguments:
--list
-h, --help Show this help message and exit
Metadata
Metadata
Assignees
Labels
No labels