1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-05-05 22:53:52 +00:00

354 Commits

Author SHA1 Message Date
pre-commit-ci[bot]
94f08d9c20 style: pre-commit.ci fixes 2025-05-02 14:47:50 +00:00
Philip Top
433ee18d0c update documentation and tests on prefix matching and clean up close match function. 2025-05-02 07:46:58 -07:00
allcontributors[bot]
8fa8a0fa0c
📝 Add ComixHe as a contributor for code (#1137)
Adds @ComixHe as a contributor for code.

This was requested by phlptp [in this
comment](https://github.com/CLIUtils/CLI11/pull/1132#issuecomment-2702742598)

[skip ci]

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2025-03-05 20:34:07 -08:00
allcontributors[bot]
38e370f671
📝 Add gblanco92 as a contributor for code (#1131)
Adds @gblanco92 as a contributor for code.

This was requested by phlptp [in this
comment](https://github.com/CLIUtils/CLI11/pull/1129#issuecomment-2694425412)

[skip ci]

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2025-03-04 06:53:37 -08:00
Philip Top
4160d259d9
update version and changelog for 2.5 release (#1121)
update readme, changelog, and version for 2.5 release

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2025-02-27 04:25:31 -08:00
allcontributors[bot]
a48f049365
📝 Add jmarrec as a contributor for code (#1127)
Adds @jmarrec as a contributor for code.

This was requested by phlptp [in this
comment](https://github.com/CLIUtils/CLI11/pull/1122#issuecomment-2682507198)

[skip ci]

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
Co-authored-by: Philip Top <phlptp@gmail.com>
2025-02-25 16:19:35 -08:00
allcontributors[bot]
091d4cfb3b
📝 Add nshaheed as a contributor for platform (#1126)
Adds @nshaheed as a contributor for platform.

This was requested by phlptp [in this
comment](https://github.com/CLIUtils/CLI11/pull/1122#issuecomment-2682506808)

[skip ci]

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
Co-authored-by: Philip Top <phlptp@gmail.com>
2025-02-25 14:10:38 -08:00
allcontributors[bot]
8d5d0967a0
📝 Add j-rivero as a contributor for platform (#1124)
Adds @j-rivero as a contributor for platform.

This was requested by phlptp [in this
comment](https://github.com/CLIUtils/CLI11/pull/1122#issuecomment-2682497166)

[skip ci]

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
Co-authored-by: Philip Top <phlptp@gmail.com>
2025-02-25 13:37:15 -08:00
allcontributors[bot]
8fcbddadd3
📝 Add krico as a contributor for code (#1125)
Adds @krico as a contributor for code.

This was requested by phlptp [in this
comment](https://github.com/CLIUtils/CLI11/pull/1122#issuecomment-2682503164)

[skip ci]

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2025-02-25 12:00:31 -08:00
allcontributors[bot]
65220bd28a
📝 Add jsoref as a contributor for doc (#1123)
Adds @jsoref as a contributor for doc.

This was requested by phlptp [in this
comment](https://github.com/CLIUtils/CLI11/pull/1122#issuecomment-2682493678)

[skip ci]

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2025-02-25 08:34:26 -08:00
allcontributors[bot]
6193e56935
📝 Add LostInCompilation as a contributor for code (#1122)
Adds @LostInCompilation as a contributor for code.

This was requested by phlptp [in this
comment](https://github.com/CLIUtils/CLI11/pull/1121#issuecomment-2682455232)

[skip ci]

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2025-02-25 08:33:53 -08:00
Josh Soref
ef50bb35c3
Spelling (#1101)
This PR corrects misspellings identified by the [check-spelling
action](https://github.com/marketplace/actions/check-spelling) (which is
an evolution of the script I used ages ago when I first made a PR
here...).

The misspellings have been reported at
https://github.com/jsoref/CLI11/actions/runs/12194174338#summary-34017587518

The action reports that the changes in this PR would make it happy:
https://github.com/jsoref/CLI11/actions/runs/12194174680#summary-34017588281

---------

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-12-22 14:03:24 -08:00
pre-commit-ci[bot]
b71106f870
chore(deps): pre-commit.ci autoupdate (#1104)
<!--pre-commit.ci start-->
updates:
- [github.com/pre-commit/mirrors-clang-format: v19.1.4 →
v19.1.5](https://github.com/pre-commit/mirrors-clang-format/compare/v19.1.4...v19.1.5)
<!--pre-commit.ci end-->

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-12-22 13:57:27 -08:00
Henry Schreiner
d9473a486b
feat: increase min CMake to 3.10 (#1084)
Close https://github.com/CLIUtils/CLI11/issues/1082.

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-11-15 05:40:46 -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
Philip Top
ca66827263
Subcommand fallthrough (#1073)
Add modifier for subcommands to restrict subcommands falling through to
parent.
This will resolve #1022

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-10-09 04:46:45 -07:00
Philip Top
f7600953d4
add a round trip test to the fuzzer (#1060)
This is the next phase of the fuzzer. It runs a round trip and makes
sure that the config files generated by the app will load into the same
results, to test full round trip on the config files.

Issues fixed
- fix a bug in the string escape code caught by initial round trip tests
- resolve inconsistencies in handling of {} for empty vector indication
between config and cli parsing

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-09-23 06:13:47 -07:00
Uilian Ries
f4f225d9a2
docs: Add Conan installation in the documentation (#1061)
Greetings, fellow CLI11 community!

We have just added the latest version of cli11 to [Conan
Center](https://conan.io/center/recipes/cli11?version=2.4.2) and thought
it would be a nice addition to include instructions on how to install
CLI11 via Conan in the book folder.

Please let me know if this is okay, or if you would prefer it placed
elsewhere.

**UPDATE**: Some extra information to be more clear about the used
command line and links:

I did not mention how to install/configure Conan, because both links to
conan.io and conan-center-index has all Conan documentation updated. For
instance: https://conan.io/downloads

The latest version of CLI11 available in Conan Center is 2.4.2:

- https://conan.io/center/recipes/cli11?version=2.4.2

or, can be found by running the conan command:

    conan search "cli11"

The command `conan install --requires="cli11/[*]" --build=missing`
means:

* conan install: Install a package from a remote. By default, it points
to the official Conan Center
* --requires="cli11/[*]": Install the latest version of CLI11 available
in Conan Center
* --build=missing: In case not finding a pre-built package compatible,
build it from source then.


Regards!

---------

Signed-off-by: Uilian Ries <uilianries@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-08-10 15:17:38 -07:00
Philip Top
b038a403ca
Issue cleanup (#1059)
Fix docstring related to #1052 
Fix config_to_string with defaults #1007

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-07-29 05:32:11 -07:00
pre-commit-ci[bot]
3afddf3578
chore(deps): pre-commit.ci autoupdate (#1051)
<!--pre-commit.ci start-->
updates:
- [github.com/pre-commit/mirrors-clang-format: v18.1.5 →
v18.1.6](https://github.com/pre-commit/mirrors-clang-format/compare/v18.1.5...v18.1.6)
<!--pre-commit.ci end-->

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-11 12:35:37 -04:00
Philip Top
08d840bfbe
Group merge (#1039)
This PR adds a mechanism to hide groups but have their options visible
as part of the parent.
This works for option group names starting with a '+'

for example 
```
 CLI::App app;

    bool flag = false;
    std::optional<bool> optional_flag = std::nullopt;

    app.add_option("--tester");
    auto *m1=app.add_option_group("+tester");

    m1->add_option("--flag", flag, "description");
    m1->add_option("--optional_flag", optional_flag, "description");

    CLI11_PARSE(app,argc, argv);
```
will produce help as 
```txt
Options:
  -h,--help                   Print this help message and exit
  --tester
  --flag BOOLEAN              description
  --optional_flag BOOLEAN     description
```

instead of 
```
Options:
  -h,--help                   Print this help message and exit
  --tester
[Option Group: tester]
  Options:
    --flag BOOLEAN              description
    --optional_flag BOOLEAN     description

```

Fixes issue #1034 and a few other past issues or questions

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-05-20 11:14:55 -07:00
Henry Schreiner
6c7b07a878
chore: prepare version 2.4.2 (#1037)
Prepare for release.

---------

Signed-off-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: Philip Top <phlptp@gmail.com>
2024-05-04 00:50:51 -04:00
Henry Schreiner
e4ee3af785
chore: clean out some mentions of appveyor (#990) 2024-02-04 23:41:56 -05:00
Henry Schreiner
cc9407287f
chore: bump wandbox demo (#992) 2024-02-04 23:41:42 -05:00
Philip Top
88e9bb1741
docs: release update (#974)
Update the Readme and the changelog in preparation for a release.

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Henry Schreiner <henry.fredrick.schreiner@cern.ch>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-02-04 22:59:34 -05:00
Henry Schreiner
ef327b7883
chore: sort contributors alphabetically (#978)
This is getting long, and order isn't meaningful, so let's make it
alphabetical.

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-01-12 09:33:43 -05:00
Henry Schreiner
b6e367db88
chore: update all-contributors (#977)
The bot isn't working and we've not really been keeping this up. This is
everything from `yarn run all-contributors check`.

- 📝 Add @dherrera-fb as a contributor
- 📝 Add @VolkerChristian as a contributor
- 📝 Add @thewtex as a contributor
- 📝 Add @polistern as a contributor
- 📝 Add @andreasxp as a contributor
- 📝 Add @SherlockInSpace as a contributor
- 📝 Add @Krzmbrzl as a contributor
- 📝 Add @RangeMachine as a contributor
- 📝 Add @ptheywood as a contributor
- 📝 Add @peterh as a contributor
- 📝 Add @PeteAudinate as a contributor
- 📝 Add @captainurist as a contributor
- 📝 Add @djerius as a contributor
- 📝 Add @shameekganguly as a contributor
- 📝 Add @ayum as a contributor
- 📝 Add @BenjaminBeichler as a contributor
- 📝 Add @DarkWingMcQuack as a contributor
- 📝 Add @eli-schwartz as a contributor
- 📝 Add @bruxisma as a contributor
- 📝 Add @j-rivero as a contributor
- 📝 Add @looopTools as a contributor
- 📝 Add @cetius as a contributor
- 📝 Add @nathanielhourt as a contributor
2024-01-11 11:39:57 -05:00
Philip Top
de1c6a1207
Escape transform and docs (#970)
Update some documentation and add a string escape transformer so escaped
strings can be handled on the command line as well as in the config
files.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-01-06 06:29:46 -08:00
Henry Schreiner
3bc2739c11
docs: use gfm notes in README (#952)
A fairly new addition to GitHub Flavored Markdown.

---------

Signed-off-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: Philip Top <phlptp@gmail.com>
2023-12-18 05:17:42 -08:00
Philip Top
319e918af6
update docs on usage to indicate it is only available on main (#959)
fix missing doc indicator on usage method

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-12-16 06:47:44 -08:00
Philip Top
583c1abfc6
add an example of capturing the arguments after a specific option. (#944)
Based on Issue #931 and #942.  
Add an example of how to do what those issues were requesting.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-11-03 06:29:00 -07:00
Philip Top
bc8a0243c4
Multiline string config (#935)
Support for TOML style multiline string values and comments
2023-10-27 14:31:43 -07:00
Philip Top
ff1ec84e35
Env validation (#926)
Fixes #925
2023-10-06 08:37:48 -07:00
Andrey Zhukov
0d4e19133c
feat: unicode API rework (#923)
Fixes #845 as discussed.

Comparing the two approaches of getting `argv`:
1. The "old" way, through `CLI::argv()`:
    ✔️ Works automatically and almost everywhere
     Small abstraction overhead on macOS
     Does not work in weird edge-cases such as missing `/proc`
2. This PR, through `app.ensure_utf8`:
✔️ True zero-overhead abstraction: you don't pay for what you don't use
✔️ Less moving parts than the "old" approach, probably can't be broken
 Requires extra code to be written by the user (which is sad because
ideally everyone should use this by default)

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-09-20 13:20:53 -04:00
Philip Top
ccf141c49d
docs: move and update installation (#901)
This PR includes updates from #774 and #613.  
It updates the readme and docbook with some additional installation
instructions.

---------

Co-authored-by: Owen Parkins <oparkins@users.noreply.github.com>
Co-authored-by: Mengna Li <Adela0814@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-07-11 08:43:16 -04:00
Philip Top
985a19f386
fix some doc and error strings (#899)
Update some doc strings and error output for clarity

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-06-29 08:29:32 -07:00
Henry Schreiner
f07a8cc6fb
fix: increase min CMake to 3.5 (#898)
CMake 3.27 will start warning if this is older than 3.5.

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2023-06-28 16:24:27 -04:00
allcontributors[bot]
335ca29dcb
📝 Add trokhymchuk as a contributor for code (#895)
Adds @trokhymchuk as a contributor for code.

This was requested by phlptp [in this
comment](https://github.com/CLIUtils/CLI11/pull/893#issuecomment-1610366995)

[skip ci]

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2023-06-27 17:44:44 -07:00
Andrey Zhukov
a227cd10fc
feat: unicode support (#804)
* Add unicode support tests

* Add unicode parse tests

* Implement #14

* Slim down Windows.h

* Fix documentation comments

* Fix clang-tidy and cpplint

* Update README

* Fix clang-tidy

* Fix to_path not being available on linux

* Add roundtrip encoding tests

* style: pre-commit.ci fixes

* Fix pre-commit.ci

* Fix codacy

* Exclude parse_unicode which should not contain a newline from pre-commit

* Remove a test which breaks CI

* Fix build in CI

* Replace broken execute_with tests

* Fix wide string conversions on all systems

* Fix system args on apple

* style: pre-commit.ci fixes

* Fix some includes

* Fix wrong size calculation and comments

* Add guards around codecvt

* Fix _Pragma not recognized on MSVC

* Fix bad macro check

* Fix include

* Fix narrow and widen when codecvt is missing

* Fix some weird bug in old MSVC

* Add dependent applications to meson-build

* Fix precompilation

* Fix lint

* Fix coverage

* Update README

* style: pre-commit.ci fixes

* Fix lint

* Fix coverage

* Fix optional braces offending clang

* Remove copied comments from Windows.h

* Suppress flawfinder detects

* Fix cmake config tests failing because of a missing lib

* chore: update copyright on new files to 2023

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>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
2023-01-12 15:03:20 -05:00
Philip Top
4c7c8ddc45
feat: dot notation (#789)
* Allow using dot notation for subcommand arguments  such as --sub1.field

* add tests for dot notation for subcommands

* style: pre-commit.ci fixes

* add test for short form arguments in dot notation

* style: pre-commit.ci fixes

* add _pre_parse_callback_ support using dot notation

* style: pre-commit.ci fixes

* update cmake tests to include 3.24

* change line endings

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-01-04 10:05:40 -05:00
polistern
d3505540e7
feat: added usage message replacement feature (#786)
* fix: show newline before footer only if footer is set and not empty

* feat: added usage message replacement feature

* fix: tests corrected for new help message formatting
2023-01-04 10:04:54 -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
a66ae41457
chore: bump version (#782)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2022-10-06 00:09:41 -04:00
Henry Schreiner
4f14dbde63 style: run pre-commit on linewidth 2022-05-10 13:47:38 -04:00
Henry Schreiner
0038ad4658 style: run prettier 2022-05-10 13:47:38 -04:00
Philip Top
b9be5b9444
docs: update readme and changelog and version number (#718)
* Update readme and changelog and version number

* style: pre-commit.ci fixes

* fix missing references

* style: pre-commit.ci fixes

* merge in changes from non existent 2.1.3 patch release

* Update CHANGELOG.md

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
Co-authored-by: Henry Schreiner <henry.fredrick.schreiner@cern.ch>
2022-03-26 23:35:05 -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
e29cb3f1b4
feat: support empty vector in TOML (#660)
* add tests which suppose to pass

* Update ConfigFileTest.cpp

* Update ConfigFileTest.cpp

* style: pre-commit.ci fixes

* add the possibility for an empty vector result if allowed.

* style: pre-commit.ci fixes

* add empty vector command line tests

* update book and readme

* add no default test

Co-authored-by: puchneiner <90352207+puchneiner@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-02-09 13:12:55 -05:00
Philip Top
256559401e
Add a transform/validator that checks for files on a default path. (#698)
* Add a transform/validator that checks for files on a default path.

* update docs and add tests and capability of chaining the FileOnDefaultPath transform

* style: pre-commit.ci fixes

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>

* add test of "or" operation and few doc additions

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-01-31 15:07:54 -08:00
Philip Top
a5498bed17
feat: add an option to validate optional arguments like in a vector. (#668)
* add an option to validate optional arguments like in a vector.  This can resolve some issues with separating positionals from vector arguments

* style: pre-commit.ci fixes

* add some updates to the book

* style: pre-commit.ci fixes

* fix some precommit issues

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-28 11:15:55 -05:00