Releases: andrey-zherikov/argparse
v0.7.0
Enhancements
-
Added support for subcommands through new
SubCommands
UDA that can be used to specify subcommands in the parent command (onlySumType
is supported):@SubCommands SumType!(cmd1, cmd2) command;
-
New
CLI
template for mixingmain
(the original oneMain
will be removed soon):mixin CLI!Program.main!newMain; mixin CLI!(CMD1, CMD2, CMD3).main!newMain mixin CLI!(config, Program).main!newMain; mixin CLI!(config, CMD1, CMD2, CMD3).main!newMain
-
Command
UDA got newShortDescription
function to set a command description that's shown in "Available commands" section on help text of the parent command. -
Added support of multi-line argument description (i.e. those that has
'\n'
).
Breaking changes
ParseCLIResult
is renamed toResult
.
v0.6.0
Enhancements
-
New
ArgumentGroup
UDA for argument grouping in help message:@(ArgumentGroup("group1").Description("group1 description")) { @NamedArgument { string a; string b; } @PositionalArgument(0) string p; }
-
New
RequiredTogether
UDA for arguments that must be specified together:@RequiredTogether() { string a; string b; }
-
New
MutuallyExclusive
UDA for arguments that can't be specified together:@MutuallyExclusive() { string a; string b; }
v0.5.0
Enhancements
-
NamedArgument
UDA can be used without parentheses:@NamedArgument string a; @(NamedArgument.Required()) int b;
-
TrailingArguments
UDA can be used without parentheses:@TrailingArguments string[] args;
-
Argument names can be listed without putting them into an array:
@NamedArgument("a","apple","appl") int apple;
-
New
Placeholder
property that can be used withNamedArgument
andPositionalArgument
UDAs to indicate the value of the argument in help message:@NamedArgument string s; @(NamedArgument.Placeholder("VALUE")) string p;
This is how it looks on help page:
-s S
and-p VALUE
-
Added validation of the values for enum types. In case if the incorrect value is passed, this message will be printed:
Error: Invalid value 'kiwi' for argument '--fruit'. Valid argument values are: apple,pear,banana
-
Added
*NumberOfValues
properties to specify number of values that an argument can receive (see readme for details):@(NamedArgument.NumberOfValues(1,3)) int[] a; @(NamedArgument.NumberOfValues(2)) int[] b;
-
Added
AllowedValues
property to specify the values that an argument can receive (see readme for details):@(NamedArgument.AllowedValues!(["apple","pear","banana"])) string fruit;
Breaking changes
-
HelpText
is renamed toDescription
:@(NamedArgument.Description("some description")) string a;
-
MetaValue
(it was not documented) is renamed toPlaceholder
v0.4.0
Enhancements
- Added support for basic use case without UDAs
- Added
main
function wrappers
v0.3.0
Enhancements
- Added help generation.
- Additional parsing functions that accept callback:
int parseCLIKnownArgs(T, FUNC)(string[] args, FUNC func, in Config config = Config.init, T initialValue = T.init)
int parseCLIArgs(T, FUNC)(string[] args, FUNC func, in Config config = Config.init, T initialValue = T.init)
Breaking changes
CommandLineParser
struct is removed. Use one ofparseCLIArgs
orparseCLIKnownArgs
functions instead.
v0.2.0
- Added support for callbacks