This has been bounced around for a couple years now
#474 and a few others have expressed desire to work with non-standard
option names. We have been somewhat resistant to that but I think it can
be done now. This PR adds a modifier `allow_non_standard_option_names()`
It is purposely long, it is purposely off by default. But what it does
is allow option names with a single `-` to act like a short option name.
With this modifier enabled no single letter short option names are
allowed to start with the same letter as a non-standard names. For
example `-s` and `-single` would not be allowed.
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
Is there an easy way to pre-install this in CI or download it (perhaps
in meson)? It's bad that we aren't running in CI with version 3 (but
don't want to drop 2, since we can't drop it until we drop C++11).
---------
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Update and test with some newer compilers and cmake versions
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* add a counting flag to address and issue with optional<bool> and make the flags more consistent
* move the add_flag to a single operation and add a Sum multi option policy
* style: pre-commit.ci fixes
* remove sum_flag_vector overloads
* style: pre-commit.ci fixes
* add limits include
* style: pre-commit.ci fixes
* fix some other warnings
* update docs describing the multi_option_policy
* Apply suggestions from code review
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
* Fix the compile issues with the boost<optional> tests and catch
* tests: add Boost test (back)
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
add a test for char options
add support for char types to the lexical cast, to allow single character types that make sense, add a integral_conversion operations to simplify the conversions from string to integers and allow discrimination in a few cases with enumerations.
* Update options.md book chapter and the readme to better reflect current usage and the modifications to the add_options templates.
add support in add_option for wrapper types, such as std::optional, boost::optional or other types with a value_type trait. Add support for generalized containers beyond vector, add support for nested tuples and vectors, and complex numbers directly in add_option. This includes several new type traits and object categories.
Upgrade the google test version to better support templated tests.
add support for vector argument separator `%%`
* update formatting to match recent changes
* Apply suggestions from code review
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
* Add std checking and try to fix filesystem being used on macOS 10.14
* Adding extra check recommeded by @phlptp
* suppress the double to int warning in msvc 2019 in the optional test
Co-authored-by: Philip Top <top1@llnl.gov>
* add expanded type_size specification
* add some more checks for type_size_max
* continued work on getting type sizes more flexible
* make some more tweaks to option to split up validate and reduce sections
* git rid of exceptions on the type_size functions exceptions, allow any number to be entered for the min and max and don't make a distinction between flags and other types.
* add expected count
* add the allow extra args flag in an option
* start working in allow_extra_args
* write some stuff in the book, and continue working on the failing test cases
* fix a few more of the helpers tests
* a few more test cases running
* all tests pass, fixing calls in ini files
* get vector<pair> working and all tests passing
* change callback to use reference to remove allocation and copy operation
* add support and test for vector<vector<X>>
* change Validators_ to validators_ for consistency
* fix linux warnings and errors by reording some templates and adding some typename keywords
* add support for std::vector<X> as the cross conversion type so optional<std::vector<X>> is supported using the full template of add_option.
* a few more test cases to take care of some coverage gaps
* add missing parenthesis
* add some more tests for coverage gaps
* add test for flag like option
* add transform test for `as<X>` function and make it pass through the defaults
* add a few more tests and have vector default string interpreted correctly.
* add test for defaulted integer, and route default string for defaulted value which would otherwise be empty
* some code cleanup and comments and few more test coverage gap tests
* add more tests and fix a few bugs on the type size and different code paths
* remove path in results by fixing the clear of options so they go back to parsing state.
* get coverage back to 100%
* clang_tidy, and codacy fixes
* reorder the lexical_conversion definitions
* update some formatting
* update whitespace on book chapter
* add some tests with default capture on the two parameter template and some notes about it in the README.md
remove the test from visual studio 2015
vs2015 doesn't seem to properly deal with is_assignable in the cases we care about so make a standalone version that is more direct in what we are doing
add version to appveyor and add some notes to the readme
fix a few test cases to make sure code is covered and test a few other paths
remove unneeded enum streaming operator
add some diagnostic escapes around trait code to eliminate gcc Wnarrowing warnings
work specification of the template operations
remove optional add some templates for options conversions
add the two parameter template for add_option
* Fix some comments from Code review and add more description
* fix case when string_view doesn't work to append to a string.
* This PR also addressed #300
* modify lexical_cast to take const std::string &, instead of by value to allow string_view in a few cases
* some tweaks with optional
* remove set_results function that was bypassing some of the result processing in some cases of config files.
* add positional Validator example and tests add CLI::Number validator.
* add positional Validator example and tests add CLI::Number validator.
* do some reformatting for style checks and remove auto in test lambda.