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>
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>
Take the configurability of an option into account when determining
ambiguous names and conflicts.
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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>
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>
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.
This is follow up work to my previous series. I've tried to make the
Meson build mirror the CMake build more closely. I've also made an
attempt at adding some instructions to the documents on using Meson.
---------
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>
Adds support for building with Bazel. If merged, I can push this to
https://registry.bazel.build/ when a new release is cut :)
---------
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Caleb Zulawski <caleb.zulawski@caci.com>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
See https://github.com/CLIUtils/CLI11/pull/1025.
---------
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Hello. Thank you for this tool.
I found a few small typos in the RequiredError class.
This is an error message I received:
```
Requires at most 2 options be used and 3were given from [filename,--get-size,--get-size2]
```
This PR changes the error message to
```
Requires at most 2 options be used but 3 were given from [filename,--get-size,--get-size2]
```
Happy to make changes as needed!
## Source
```cpp
std::string filename;
bool get_size = false;
CLI::App app{"Program to read a file specified as command-line argument"};
app.add_option("filename", filename, "File to read")->required();
app.add_flag("--get-size", get_size, "Print the size of the file");
app.add_flag("--get-size2", get_size, "Print the size of the file2");
app.require_option(1, 2); // Enforce only one flag can be input
CLI11_PARSE(app, argc, argv);
```
## Further Idea
Also, another idea I had was to remove required options from this error
message. In this example, "filename" is required, so a better error
message would be
```
Requires at most 1 options be used but 2 were given from [--get-size,--get-size2]
```
I'm happy to look into this if you feel it would be valuable
Added include-what-you-use pragmas to:
* let IWYU point users to the main include file CLI/CLI.hpp
* tell IWYU that CLI/CLI.hpp is the main exporting header.
This should fix#816
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Philip Top <phlptp@gmail.com>
This series cleans up and modernizes the Meson code a bit:
- It adds the license SPDX name to the proper field
- Sets a minimum version, the version is fairly old, but without setting
a version then Meson will never warn about issues, including potentially
important ones like "this happens to work in some cases but wasn't
intended and doesn't work in all cases"
- uses more modern Meson features to make things easier for consumers
- Fixes the tests using the ensure_utf8 helpers by ensuring that they're
actually built, and placing them in the correct path.
- Adds the Meson test to the CI
get_subcommand when used for parsing config files, was throwing and
catching as part of control flow and expected operation, this resulting
in a performance hit in select cases. A get_subcommand_no_throw was
added to resolve this issue.
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
The extra leading `"CLI/"` part of include directives prevents the
inclusion of `CLI.hpp` from a relative directory without an extra `-I`
or `/I` compiler directive, and makes it harder to make CLI11 part of a
larger codebase.
This is a regression of #475.
Bumps the actions group with 1 update:
[softprops/action-gh-release](https://github.com/softprops/action-gh-release).
Updates `softprops/action-gh-release` from 1 to 2
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/softprops/action-gh-release/releases">softprops/action-gh-release's
releases</a>.</em></p>
<blockquote>
<h2>v2.0.0</h2>
<ul>
<li>update actions.yml declaration to node20 to address warnings</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md">softprops/action-gh-release's
changelog</a>.</em></p>
<blockquote>
<h2>0.1.12</h2>
<ul>
<li>fix bug leading to empty strings subsituted for inputs users don't
provide breaking api calls <a
href="https://redirect.github.com/softprops/action-gh-release/pull/144">#144</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="d99959edae"><code>d99959e</code></a>
prep release</li>
<li><a
href="0e39c679e8"><code>0e39c67</code></a>
make pattern error opt in (<a
href="https://redirect.github.com/softprops/action-gh-release/issues/417">#417</a>)</li>
<li><a
href="20e085ccc7"><code>20e085c</code></a>
kick off 2.0.1 release</li>
<li><a
href="9f5c4d39bc"><code>9f5c4d3</code></a>
update changelog</li>
<li><a
href="0bea76b227"><code>0bea76b</code></a>
Add support for make_latest property (<a
href="https://redirect.github.com/softprops/action-gh-release/issues/304">#304</a>)</li>
<li><a
href="762fe13dfb"><code>762fe13</code></a>
typo in changelog</li>
<li><a
href="c0f2569fb9"><code>c0f2569</code></a>
remove unused script</li>
<li><a
href="5743e06024"><code>5743e06</code></a>
update changelog</li>
<li><a
href="fe71fd3b91"><code>fe71fd3</code></a>
Don't swallow errors (<a
href="https://redirect.github.com/softprops/action-gh-release/issues/384">#384</a>)</li>
<li><a
href="9150ab13f3"><code>9150ab1</code></a>
rebuild and update changelog</li>
<li>Additional commits viewable in <a
href="https://github.com/softprops/action-gh-release/compare/v1...v2">compare
view</a></li>
</ul>
</details>
<br />
[](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions
</details>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Fix an issue with environmental variable parsing in option_groups, and
an issue with remaining in config files.
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Quick release fixing the missing header.
---------
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>
Correct an anomaly when using config file processing with a default. In
this case the count always shows 1 even if the default file were not
actually used. This caused some issues in some applications and was a
change from previous versions.
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Fix https://github.com/CLIUtils/CLI11/issues/999.
This looks like about what we have to do. This test seems to be missing
from Meson, so don't have a workaround there yet.
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Fix#993. I tried include-what-you-use, but it reports too much stuff to
be able to pick out what's missing very effectively.
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
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>
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>
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
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>
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>
The current installation documentation for FetchContent with CMake,
result in the following error Error:
```
CMake Error at /opt/homebrew/Cellar/cmake/3.28.1/share/cmake/Modules/FetchContent.cmake:1221 (message):
No content details recorded for cli11
Call Stack (most recent call first):
/opt/homebrew/Cellar/cmake/3.28.1/share/cmake/Modules/FetchContent.cmake:1740 (__FetchContent_getSavedDetails)
/opt/homebrew/Cellar/cmake/3.28.1/share/cmake/Modules/FetchContent.cmake:2033 (FetchContent_Populate)
CMakeLists.txt:17 (FetchContent_MakeAvailable)
```
The important part: ` No content details recorded for cli11`.
I have changed the documentation such that the part which covers
FetchContent works out of the box.
This PR is to further support for TOML. To allow and generate quoted
names in config files including those separated by the parent separator.
like
```toml
"sub"."sub2".value=1
'sub'.'sub.sub'.value=2
```
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Add escaping to quoted strings, differentiate between literal and
regular strings.
The goal is to make string processing in config files as close as
possible to toml standards. This means handing escape sequences
including unicode, and differentiating between literal strings and
regular strings in files and when splitting the command line. Also
allowing variable names in the files to be quoted.
This PR gets partway there. Removes some hacks from the previous PR to
deal with unusual option names and replaces with the quoted names.
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>