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

43 Commits

Author SHA1 Message Date
Philip Top
74c86d4889
update copyright dates to 2025 (#1112) 2025-01-03 08:35:31 -08:00
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
captainurist
2e8697cea1
Can add lexical_cast overloads constrained with enable_if (#1021)
Also works for overloads constrained with concepts or requirements.

Previously this wasn't working, which is a problem if you want to hook
some external serialization framework into CLI11 without painstakingly
going through all the types that said external framework supports.

This PR is related to https://github.com/CLIUtils/CLI11/issues/908.
2024-05-02 08:02:59 -07:00
Philip Top
9dfeefe2ba
update copyright date to 2024 (#971)
update copyright dates
2024-01-06 08:08:31 -08:00
pre-commit-ci[bot]
9e8bceb91d
chore(deps): pre-commit.ci autoupdate (#927)
<!--pre-commit.ci start-->
updates:
- [github.com/codespell-project/codespell: v2.2.5 →
v2.2.6](https://github.com/codespell-project/codespell/compare/v2.2.5...v2.2.6)
<!--pre-commit.ci end-->

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Philip Top <phlptp@gmail.com>
2023-10-03 17:48:27 -07:00
Henry Schreiner
8e4fd15a23
fix(tests): experimental support for external Catch3 (#827)
* fix(tests): experimental support for external Catch3

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* style: pre-commit.ci fixes

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-03-09 15:03:03 -05:00
Philip Top
0a615f854d
fix: issue found by fuzzing (#846)
* Add the beginnings of a fuzzing system for CLI11.  This commit adds the fuzzing code, a simple test, and two fixes to issues(seg faults) found by the initial round of fuzzing.  It also adds a few tests and coverage issues uncovered in the process of developing the fuzz tests. As a side effect adjusts some of the azure tests to specify the vmImage which was being changed on azure.

* update license to match rest of code base

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-03-09 15:02:49 -05:00
Philip Top
39a5f1981e
chore: update copyright year to 2023 (#825) 2023-01-03 17:29:37 -05:00
captainurist
3897109e51
Using ADL everywhere for lexical_cast (#820)
* Using ADL everywhere for lexical_cast

* Fixes in docs

* Add a test for old extension mechanism

* style: pre-commit.ci fixes

* Make gcc happy

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Philip Top <phlptp@gmail.com>
2023-01-02 07:09:27 -08:00
Henry Schreiner
c781998273
chore: clang tidy updates (#742)
* chore: update clang-tidy

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* refactor: address clang-tidy

* fix: C++11 support

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* chore: two more clang-tidy fixes

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* fix: get_inject_separator should be bool

* refactor: addressing review feedback

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Philip Top <phlptp@gmail.com>

* Apply suggestions from code review

* Update include/CLI/Config.hpp

* Update include/CLI/Config.hpp

* Update include/CLI/Config.hpp

* Update include/CLI/Config.hpp

Co-authored-by: Philip Top <phlptp@gmail.com>
2022-06-26 14:53:01 -04:00
Philip Top
4cae08686d
docs: update copyright dates to 2022 (#717) 2022-03-26 21:54:49 -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
c4f1fc8ea7
refactor!: remove add_complex (#600) 2021-06-16 20:33:22 -04:00
Henry Schreiner
e2e3cb2fed
refactor!: drop defaulted from add_option (#597) 2021-06-16 11:16:22 -04:00
Henry Schreiner
5d12e11d8a tests: use catch2 2021-04-04 00:29:21 -04:00
c.bachhuber
7432ab264d Fix code style
Format
2020-03-23 09:42:08 -04:00
Christoph Bachhuber
a1ef417b8d Remove cpplint's build/c++11 check
Fix rebase
2020-03-23 09:42:08 -04:00
Christoph Bachhuber
534792577d Do not lint chrono, thread, and regex 2020-03-23 09:42:08 -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
d8a5bdc294
Add and fix cpplint whitespace/comments (#434)
* Add whitespace/comments check

* Adapt spacing in clang-format

* Fix cpplint whitespace/comments issues

* Grammar

* Do not use clang-format for comment spacing

* Fix with clang-format pre-commit hook
2020-03-06 00:04:59 -05:00
Philip Top
6b7f6a7480 Value initialization (#416)
* work on the flags book chapter and making sure the values are initialized properly.

* Fix initialization of values used in flags or options

* update some formatting and more brace initialization

* update more formatting and fix a incorrect initializer

* more formatting and some error fixes

* more formatting

* Small formatting fix

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2020-01-27 09:42:03 -06: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 Fredrick Schreiner
2244ecc3f3 Adding and fixing Weffc++ 2019-11-29 21:49:05 -05:00
Philip Top
5f696596d7 fix some warnings generated from klocwork static analyzer (#350)
* fix some warnings generated from klocwork static analyzer

* Some more visual studio static analyzer and clang-tidy fixes

* some formatting updates
2019-11-29 08:54:32 -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
Philip Top
127f5388ab Support tuple (#307)
* 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

* start work on trying to clean up the type traits for which lexical cast overload to use

* fix readme issue and make the condition tests a little clearer

* add a check for out of range errors on boolean conversions

* Fix capitalization and some comments on option functions

* Allow immediate_callback on the main app to run the main app callback prior to named subcommand callbacks, and reflect this change in the a new test and docs.

* add a is_tuple_like trait, and type_count structure for getting the number of elements to require

* add lexical conversion functions for tuples and other types

* remove the separate vector option and option function

* test out the type names for tuples

* add some more lexical conversion functions and test

* more work on tuples and tests

* fix some merge warnings

* fix some typename usage and c++14 only constructs

* tweak some of the template to remove undefined references

* add extra static assert about is_tuple_like

* fix some undefined references in clang

* move around some of the type_count templates to be used in the type_name functions

* move the type_count around and add some additional checks on the classification

* add some info to the readme
2019-08-16 09:58:15 -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
9f81385bcd Option delimiter (#240)
* move delimiter controls to Option vs in the App callbacks
2019-02-27 18:04:21 +01:00
Henry Schreiner
b4910df3d7
Move to using literals in testing (#213) 2019-02-01 11:32:47 +01:00
Philip Top
b26894458b add some more tests of custom parsers and adjustments to the README
Add a test that creates and uses a custom parser to store a value

add a check around regex to see if it is working

fix warning in AppTest from gcc
2019-01-31 23:53:04 +01:00
Henry Schreiner
bf2bc39c30 Rename to set_* on options and add return this
Now use type_name and type_size instead of set_custom_option.
2018-06-18 15:13:59 +02:00
Henry Fredrick Schreiner
bea833bbcd Adding and fixing more warnings 2018-03-26 11:48:23 +02:00
Henry Schreiner
97b6265cee
Dropping check for size in test (not needed anymore) 2017-12-06 14:59:28 -05:00
Henry Fredrick Schreiner
14a8c55301 Fixing test error with clang + stdlibc++ 2017-11-30 16:29:30 -06:00
Henry Fredrick Schreiner
f6c9ce6109 Moving code to Error, better ArgumentMismatch throwing 2017-11-26 15:11:48 -05:00
Henry Fredrick Schreiner
3d309dc0be Adding fail if required values missing 2017-11-25 19:03:03 -05:00
Henry Schreiner
93311928d7 set_default_str and set_default_val update (#27)
* set_default_str and set_default_val update

* Fixes for style checking
2017-09-01 23:23:31 -04:00
Henry Fredrick Schreiner
27f718125d Reformat with clang-format 2017-05-31 12:03:05 -04:00
Henry Fredrick Schreiner
101c926dac Adding tidy cleanups (modernize) 2017-05-31 07:38:22 -04:00
Henry Fredrick Schreiner
8218425eb0 Adding one more complex test 2017-04-23 14:09:37 -04:00
Henry Fredrick Schreiner
e779d15ef8 Adding complex numbers 2017-04-05 09:29:34 -04:00
Henry Fredrick Schreiner
480d8b38ae Adding test for adding new parser 2017-03-23 10:26:54 -04:00