1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-04-29 20:23:55 +00:00

30 Commits

Author SHA1 Message Date
Philip Top
5a03ee5838
Allow non standard option names like -option (#1078)
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>
2024-10-23 05:14:29 -07:00
Henry Schreiner
20de8b73bb
tests: fix catch2 3 support (#980)
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>
2024-01-12 17:43:17 -05:00
Philip Top
35aa92d71a
update supported cmake versions and add some tests with newer compilers (#972)
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>
2024-01-08 05:40:26 -08:00
Philip Top
9dfeefe2ba
update copyright date to 2024 (#971)
update copyright dates
2024-01-06 08:08:31 -08:00
Philip Top
39a5f1981e
chore: update copyright year to 2023 (#825) 2023-01-03 17:29:37 -05:00
Philip Top
4cae08686d
docs: update copyright dates to 2022 (#717) 2022-03-26 21:54:49 -04:00
Philip Top
f7d26f26b2
feat: counting flags (#709)
* 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>
2022-03-21 18:56:35 -04:00
Philip Top
728ac3a877
run some tests and fixes for C++20 (#663) 2021-11-01 23:10:44 -04:00
Philip Top
81b092e085
tests: fix the compile issues with the boost<optional> tests and catch (#646)
* Fix the compile issues with the boost<optional> tests and catch

* tests: add Boost test (back)

Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
2021-09-28 09:33:28 -04:00
Henry Schreiner
b4f6be31c1
chore: codacity (#621)
* docs: fix some Codacity recommendations

* chore: update copyright year

* style: more codacity fixes

* style: fix issues reported by Codacity
2021-07-16 17:41:46 -04:00
Henry Schreiner
5d12e11d8a tests: use catch2 2021-04-04 00:29:21 -04:00
Philip Top
a86f7fbd5e
tests: add some extra tests from debugging (#542)
* add a test to verify std::optional<std::uint64_t> works correctly.

* adding some extra tests to help with debugging
2020-12-28 11:01:11 -05:00
Philip Top
438eabe5f8
feat: add char type (#449)
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.
2020-09-30 17:58:39 -04:00
Christoph Bachhuber
3ab92ad454 Add copyright message 2020-03-23 09:42:08 -04:00
Philip Top
27da2f952e
Container options (#423)
* 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>
2020-03-22 14:06:34 -04:00
Christoph Bachhuber
ffe5b29e1f Add cstdint and std::prefix to its symbols (#409)
* Add cstdint and std::prefix to its symbols

* Use int64_t in std::
2020-01-21 18:24:40 -06:00
Henry Schreiner
4b3a6b6214
Add std checking and try to fix filesystem being used on macOS 10.14 (#397)
* 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>
2020-01-09 13:48:19 -05:00
Philip Top
418b7175f5 Type size refactor (#325)
* 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
2019-11-10 05:36:16 +10:30
Henry Fredrick Schreiner
fda6126d7c Adding pre-commit 2019-10-24 19:07:01 -04:00
Philip Top
eab92ed988 modified option template (#285)
* 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
2019-07-29 00:19:35 -04:00
Philip Top
76d2cde656 Positional argument checks (#262)
* 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.
2019-04-11 12:04:30 +02:00
Henry Fredrick Schreiner
8635c4d0eb Dropping reset in favor of clear 2018-06-27 12:26:03 +02:00
Henry Fredrick Schreiner
87494a2270 Allow Optional search to be disabled by user 2018-06-01 22:41:25 +02:00
Henry Fredrick Schreiner
ef1aa10fdb Test all optionals 2018-04-18 23:42:17 +02:00
Henry Fredrick Schreiner
67c4eb71e5 Style and typo fix 2018-04-04 18:29:32 +02:00
Henry Fredrick Schreiner
39e777392d Adding informational printout to ctest 2018-04-04 18:29:32 +02:00
Henry Fredrick Schreiner
43ec307781 Better message about optional test, warning suppression 2018-04-04 18:29:32 +02:00
Henry Fredrick Schreiner
7a7064df4e Adding optional, refactor single file 2018-04-04 18:29:32 +02:00
Henry Fredrick Schreiner
368f2cd9a6 Fix for deprecated macro 2018-04-04 18:29:32 +02:00
Henry Fredrick Schreiner
5c0d6617d5 Adding optional test 2018-04-04 18:29:32 +02:00