argparse 3.0

argparse 3.0

Release of 3.0 C++ (C++17 dialect) header-only library for parsing command line arguments clutch, distributed under the MIT license.

What's new:

  • added support for mutually exclusive arguments:

auto &group = program.add_mutually_exclusive_group(); group.add_argument("—first"); group.add_argument("—second");

  • added C++20 module;
  • added support for selecting from multiple values:

program.add_argument("input") .default_value(std::string{"baz"}) .choices("foo", "bar", "baz"); program.add_argument("count") .default_value(0) .choices(0, 1, 2, 3, 4, 5);

  • added support for binary notation, for example 0b101:

argparse::ArgumentParser program("test"); program.add_argument("-n").scan<'b', uint8_t>();

  • added an overloaded version of is_subcommand_used, which accepts a subcommand parser;
  • added exit_on_default_arguments parameter to ArgumentParser;
  • added support for hiding subcommands from the output of the --help command:

argparse::ArgumentParser program("test"); argparse::ArgumentParser hidden_cmd("hidden"); hidden_cmd.add_argument("files").remaining(); hidden_cmd.set_suppress(true); program.add_subparser(hidden_cmd);

  • added the ability to check for parsed values ​​in ArgumentParser;
  • added alignment to multi-line help column for arguments;
  • Many bugs have been fixed.

Source: linux.org.ru

Add a comment