Skip to content

Releases: andrey-zherikov/argparse

v0.7.0

13 Mar 05:37
bcfc961
Compare
Choose a tag to compare

Enhancements

  • Added support for subcommands through new SubCommands UDA that can be used to specify subcommands in the parent command (only SumType is supported):

    @SubCommands
    SumType!(cmd1, cmd2) command;
  • New CLI template for mixing main (the original one Main 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 new ShortDescription 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 to Result.

v0.6.0

17 Dec 02:05
b7ee509
Compare
Choose a tag to compare

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

28 Nov 17:55
32801c2
Compare
Choose a tag to compare

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 with NamedArgument and PositionalArgument 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 to Description:

    @(NamedArgument.Description("some description"))  string a;
  • MetaValue (it was not documented) is renamed to Placeholder

v0.4.0

17 Oct 03:00
80e850d
Compare
Choose a tag to compare

Enhancements

  • Added support for basic use case without UDAs
  • Added main function wrappers

v0.3.0

12 Oct 20:03
bca9432
Compare
Choose a tag to compare

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 of parseCLIArgs or parseCLIKnownArgs functions instead.

v0.2.0

28 Jun 15:18
Compare
Choose a tag to compare
  • Added support for callbacks