argparse 3.0

argparse 3.0

The release of 3.0 C++ (C++17 dialect) header-only library for command-line argument parsing has taken place. argparse, distributed under the MIT license.

What's new:

  • Support for mutually exclusive arguments has been added:

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

  • A C++20 module has been added;
  • Support for selecting multiple values has been added:

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);

  • Support for binary notation has been added, for example, 0b101:

argparse::ArgumentParser program("test"); program.add_argument("-n").scan();

  • An overloaded version of is_subcommand_used has been added, which takes a subcommand parser;
  • The exit_on_default_arguments parameter has been added to ArgumentParser;
  • Support for hiding subcommands from the --help command output has been added:

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);

  • The ability to check for parsed values in ArgumentParser has been added;
  • Column alignment for multi-line help for arguments has been added;
  • many bugs fixed.

Source: linux.org.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster