There is a newer version of the record available.

Published May 20, 2019 | Version v1.8.0
Software Open

CLIUtils/CLI11: Version 1.8: Transformers, default strings, and flags

  • 1. Princeton University
  • 2. @LLNL
  • 3. European Spallation Source
  • 4. Mellanox
  • 5. Heidelberg Institute for Theoretical Studies
  • 6. @BlueMedoraPublic
  • 7. Gitter
  • 8. @ethereum
  • 9. EPFL
  • 10. Sandia National Laboratories

Description

Set handling has been completely replaced by a new backend that works as a Validator or Transformer. This provides a single interface instead of the 16 different functions in App. It also allows ordered collections to be used, custom functions for filtering, and better help and error messages. You can also use a collection of pairs (like std::map) to transform the match into an output. Also new are inverted flags, which can cancel or reduce the count of flags, and can also support general flag types. A new add_option_fn lets you more easily program CLI11 options with the types you choose. Vector options now support a custom separator. Apps can now be composed with unnamed subcommand support. The final bool "defaults" flag when creating options has been replaced by ->capture_default_str() (ending an old limitation in construction made this possible); the old method is still available but may be removed in future versions.

  • Replaced default help capture: .add_option("name", value, "", True) becomes .add_option("name", value)->capture_default_str() #242
  • Added .always_capture_default() #242
  • New CLI::IsMember validator replaces set validation #222
  • IsMember also supports container of pairs, transform allows modification of result #228
  • Added new Transformers, CLI::AsNumberWithUnit and CLI::AsSizeValue #253
  • Much more powerful flags with different values #211, general types #235
  • add_option now supports bool due to unified bool handling #211
  • Support for composable unnamed subcommands #216
  • Reparsing is better supported with .remaining_for_passthrough() #265
  • Custom vector separator using ->delimiter(char) #209, #221, #240
  • Validators added for IP4 addresses and positive numbers #210 and numbers #262
  • Minimum required Boost for optional Optionals has been corrected to 1.61 #226
  • Positionals can stop options from being parsed with app.positionals_at_end() #223
  • Added validate_positionals #262
  • Positional parsing is much more powerful #251, duplicates supported []#247]
  • Validators can be negated with ! #230, and now handle tname functions #228
  • Better enum support and streaming helper #233 and #228
  • Cleanup for shadow warnings #232
  • Better alignment on multiline descriptions #269
  • Better support for aarch64 #266
  • Respect BUILD_TESTING only if CLI11 is the main project; otherwise, CLI11_TESTING must be used #277
  • Drop auto-detection of experimental optional and boost::optional; must be enabled explicitly (too fragile) #277
Converting from CLI11 1.7:
  • .add_option(..., true) should be replaced by .add_option(...)->capture_default_str() or app.option_defaults()->always_capture_default() can be used
  • app.add_set("--name", value, {"choice1", "choice2"}) should become app.add_option("--name", value)->check(CLI::IsMember({"choice1", "choice2"}))
  • The _ignore_case version of this can be replaced by adding CLI::ignore_case to the argument list in IsMember
  • The _ignore_underscore version of this can be replaced by adding CLI::ignore_underscore to the argument list in IsMember
  • The _ignore_case_underscore version of this can be replaced by adding both functions listed above to the argument list in IsMember
  • If you want an exact match to the original choice after one of the modifier functions matches, use ->transform instead of ->check
  • The _mutable versions of this can be replaced by passing a pointer or shared pointer into IsMember
  • An error with sets now produces a ValidationError instead of a ConversionError

Files

CLIUtils/CLI11-v1.8.0.zip

Files (240.0 kB)

Name Size Download all
md5:1cf532095b61878ab7157f527c288be9
240.0 kB Preview Download

Additional details

Related works