Skip to content

Commit

Permalink
Merge branch 'main' into cpp26_codecvt
Browse files Browse the repository at this point in the history
  • Loading branch information
phlptp authored Dec 23, 2024
2 parents 57e2f5f + ef50bb3 commit e0511aa
Show file tree
Hide file tree
Showing 18 changed files with 73 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ repos:
- id: debug-statements

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.4
rev: v19.1.5
hooks:
- id: clang-format
types_or: [c++, c, cuda]
Expand Down
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ projects, and can be customized for frameworks. It is tested on [Azure][] and
fitting framework][goofit]. It was inspired by [`plumbum.cli`][plumbum] for
Python. CLI11 has a user friendly introduction in this README, a more in-depth
tutorial [GitBook][], as well as [API documentation][api-docs] generated by
Travis. See the [changelog](./CHANGELOG.md) or [GitHub Releases][] for details for
current and past releases. Also see the [Version 1.0 post][], [Version 1.3
Travis. See the [changelog](./CHANGELOG.md) or [GitHub Releases][] for details
for current and past releases. Also see the [Version 1.0 post][], [Version 1.3
post][], [Version 1.6 post][], or [Version 2.0 post][] for more information.

You can be notified when new releases are made by subscribing to
Expand Down Expand Up @@ -142,8 +142,8 @@ After I wrote this, I also found the following libraries:
| [argparse][] | C++17 single file argument parser. Design seems similar to CLI11 in some ways. The author has several other interesting projects. |
| [lyra][] | a simple header only parser with composable options. Might work well for simple standardized parsing |

See [Awesome C++][] for a less-biased list of parsers. You can also find other single
file libraries at [Single file libs][].
See [Awesome C++][] for a less-biased list of parsers. You can also find other
single file libraries at [Single file libs][].

</p></details>
<br/>
Expand Down Expand Up @@ -325,8 +325,8 @@ template to directly specify the conversion type.
Types such as (std or boost) `optional<int>`, `optional<double>`, and
`optional<string>` and any other wrapper types are supported directly. For
purposes of CLI11 wrapper types are those which `value_type` definition. See
[CLI11 Advanced Topics/Custom Converters][] for information on how you can add your
own converters for additional types.
[CLI11 Advanced Topics/Custom Converters][] for information on how you can add
your own converters for additional types.

Vector types can also be used in the two parameter template overload

Expand Down Expand Up @@ -514,7 +514,7 @@ On the command line, options can be given as:
- `-ffilename` (no space required)
- `-abcf filename` (flags and option can be combined)
- `--long` (long flag)
- `--long_flag=true` (long flag with equals to override default value)
- `--long_flag=true` (long flag with equals -- to override default value)
- `--file filename` (space)
- `--file=filename` (equals)

Expand Down Expand Up @@ -1254,7 +1254,7 @@ formatter. An example of a TOML file:

```toml
# Comments are supported, using a #
# The default section is [default], case insensitive
# The default section is [default], case-insensitive

value = 1
value2 = 123_456 # a string with separators
Expand All @@ -1275,7 +1275,7 @@ or equivalently in INI format

```ini
; Comments are supported, using a ;
; The default section is [default], case insensitive
; The default section is [default], case-insensitive

value = 1
str = "A string"
Expand All @@ -1291,7 +1291,7 @@ sub.subcommand = true
Spaces before and after the name and argument are ignored. Multiple arguments
are separated by spaces. One set of quotes will be removed, preserving spaces
(the same way the command line works). Boolean options can be `true`, `on`, `1`,
`yes`, `enable`; or `false`, `off`, `0`, `no`, `disable` (case insensitive).
`yes`, `enable`; or `false`, `off`, `0`, `no`, `disable` (case-insensitive).
Sections (and `.` separated names) are treated as subcommands (note: this does
not necessarily mean that subcommand was passed, it just sets the "defaults").
You cannot set positional-only arguments. Subcommands can be triggered from
Expand Down Expand Up @@ -1618,7 +1618,7 @@ brief description of each is included here
- [formatter](https://github.com/CLIUtils/CLI11/blob/main/examples/formatter.cpp):
Illustrating usage of a custom formatter
- [groups](https://github.com/CLIUtils/CLI11/blob/main/examples/groups.cpp):
Example using groups of options for help grouping and a the timer helper class
Example using groups of options for help grouping and a timer helper class
- [inter_argument_order](https://github.com/CLIUtils/CLI11/blob/main/examples/inter_argument_order.cpp):
An app to practice mixing unlimited arguments, but still recover the original
order.
Expand Down Expand Up @@ -1665,10 +1665,10 @@ brief description of each is included here
To contribute, open an [issue][github issues] or [pull
request][github pull requests] on GitHub, or ask a question on [gitter][]. There
is also a short note to contributors [here](./.github/CONTRIBUTING.md). This
readme roughly follows the [Standard Readme Style][] and includes a mention of
almost every feature of the library. More complex features are documented in
more detail in the [CLI11 tutorial GitBook][gitbook].
is also a [short note to contributors](./.github/CONTRIBUTING.md). This readme
roughly follows the [Standard Readme Style][] and includes a mention of almost
every feature of the library. More complex features are documented in more
detail in the [CLI11 tutorial GitBook][gitbook].
This project was created by [Henry Schreiner](https://github.com/henryiii) and
major features were added by [Philip Top](https://github.com/phlptp). Special
Expand Down
8 changes: 4 additions & 4 deletions book/chapters/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Here is an example configuration file, in
```toml
# Comments are supported, using a #
# The default section is [default], case insensitive
# The default section is [default], case-insensitive
value = 1
str = "A string"
Expand All @@ -141,7 +141,7 @@ Spaces before and after the name and argument are ignored. Multiple arguments
are separated by spaces. One set of quotes will be removed, preserving spaces
(the same way the command line works). Boolean options can be `true`, `on`, `1`,
`y`, `t`, `+`, `yes`, `enable`; or `false`, `off`, `0`, `no`, `n`, `f`, `-`,
`disable`, (case insensitive). Sections (and `.` separated names) are treated as
`disable`, (case-insensitive). Sections (and `.` separated names) are treated as
subcommands (note: this does not necessarily mean that subcommand was passed, it
just sets the "defaults". If a subcommand is set to `configurable` then passing
the subcommand using `[sub]` in a configuration file will trigger the
Expand All @@ -151,7 +151,7 @@ CLI11 also supports configuration file in INI format.

```ini
; Comments are supported, using a ;
; The default section is [default], case insensitive
; The default section is [default], case-insensitive

value = 1
str = "A string"
Expand All @@ -175,7 +175,7 @@ python doc strings.

```toml
"""
this is a multine
this is a multiline
comment
"""

Expand Down
2 changes: 1 addition & 1 deletion book/chapters/flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ command line. If you use the same name twice, or if you use the same name in
multiple flags, CLI11 will immediately throw a `CLI::ConstructionError`
describing your problem (it will not wait until the parsing step).
If you want to make an option case insensitive, you can use the
If you want to make an option case-insensitive, you can use the
`->ignore_case()` method on the `CLI::Option` to do that. For example,
```cpp
Expand Down
29 changes: 29 additions & 0 deletions book/chapters/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,3 +276,32 @@ them are unknown yet.
If building with WASI it is necessary to add the flag
`-lc-printscan-long-double` to the build to allow long double support. See #841
for more details.

## Default system packages on Linux

If you are not worried about latest features or recent bug fixes, you can
install a stable version of CLI11 using:

`sudo apt install libcli11-dev` for Ubuntu, or: `sudo dnf install cli11-devel`
on Fedora/Almalinux.

Then, in your CMake project, just call:

```cmake
find_package(CLI11 CONFIG REQUIRED)
target_link_libraries(MyTarget PRIVATE CLI11::CLI11)
```

and in your C++ file:

```cpp
#include "CLI/App.hpp"
#include "CLI/Formatter.hpp"
#include "CLI/Config.hpp"

int main(int argc, char** argv)) {
CLI::App app{"MyApp"};
// Here your flags / options
CLI11_PARSE(app, argc, argv);
}
```
2 changes: 1 addition & 1 deletion book/chapters/subcommands.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ This would allow calling help such as:

### Positional Validation

Some arguments supplied on the command line may be legitamately applied to more
Some arguments supplied on the command line may be legitimately applied to more
than 1 positional argument. In this context enabling `positional_validation` on
the application or subcommand will check any validators before applying the
command line argument to the positional option. It is not an error to fail
Expand Down
2 changes: 1 addition & 1 deletion cmake/CodeCoverage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
# - Added the option for users to set the GCOVR_ADDITIONAL_ARGS variable to supply additional
# flags to the gcovr command
#
# 2020-05-04, Mihchael Davis
# 2020-05-04, Michael Davis
# - Add -fprofile-abs-path to make gcno files contain absolute paths
# - Fix BASE_DIRECTORY not working when defined
# - Change BYPRODUCT from folder to index.html to stop ninja from complaining about double defines
Expand Down
8 changes: 4 additions & 4 deletions docs/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ QT_AUTOBRIEF = NO
# tag to YES if you prefer the old behavior instead.
#
# Note that setting this tag to YES also means that rational rose comments are
# not recognized any more.
# not recognized anymore.
# The default value is: NO.

MULTILINE_CPP_IS_BRIEF = NO
Expand Down Expand Up @@ -522,7 +522,7 @@ INTERNAL_DOCS = NO
# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
# names in lower-case letters. If set to YES, upper-case letters are also
# allowed. This is useful if you have classes or files whose names only differ
# in case and if your file system supports case sensitive file names. Windows
# in case and if your file system supports case-sensitive file names. Windows
# and Mac users are advised to set this option to NO.
# The default value is: system dependent.

Expand Down Expand Up @@ -687,7 +687,7 @@ SHOW_NAMESPACES = YES
# The FILE_VERSION_FILTER tag can be used to specify a program or script that
# doxygen should invoke to get the current version for each file (typically from
# the version control system). Doxygen will invoke the program by executing (via
# popen()) the command command input-file, where command is the value of the
# popen()) the command input-file, where command is the value of the
# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
# by doxygen. Whatever the program writes to standard output is used as the file
# version. For an example see the documentation.
Expand Down Expand Up @@ -1496,7 +1496,7 @@ EXT_LINKS_IN_WINDOW = NO

FORMULA_FONTSIZE = 10

# Use the FORMULA_TRANPARENT tag to determine whether or not the images
# Use the FORMULA_TRANSPARENT tag to determine whether or not the images
# generated for formulas are transparent PNGs. Transparent PNGs are not
# supported properly for IE 6.0, but are supported on all modern browsers.
#
Expand Down
2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ add_test(NAME shapes_all COMMAND shapes circle 4.4 circle 10.7 rectangle 4 4 cir
4.5 ++ rectangle 2.1 ++ circle 234.675)
set_property(
TEST shapes_all PROPERTY PASS_REGULAR_EXPRESSION "circle2" "circle4"
"rectangle2 with edges [2.1,2.1]" "triangel1 with sides [4.5]")
"rectangle2 with edges [2.1,2.1]" "triangle1 with sides [4.5]")

add_cli_exe(ranges ranges.cpp)
add_test(NAME ranges_range COMMAND ranges --range 1 2 3)
Expand Down
6 changes: 3 additions & 3 deletions include/CLI/App.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class App {
bool allow_extras_{false};

/// If ignore, allow extra arguments in the ini file (ie, don't throw an error). INHERITABLE
/// if error error on an extra argument, and if capture feed it to the app
/// if error, error on an extra argument, and if capture feed it to the app
config_extras_mode allow_config_extras_{config_extras_mode::ignore};

/// If true, cease processing on an unrecognized option (implies allow_extras) INHERITABLE
Expand Down Expand Up @@ -218,7 +218,7 @@ class App {
/// Storage for subcommand list
std::vector<App_p> subcommands_{};

/// If true, the program name is not case sensitive INHERITABLE
/// If true, the program name is not case-sensitive INHERITABLE
bool ignore_case_{false};

/// If true, the program should ignore underscores INHERITABLE
Expand Down Expand Up @@ -1216,7 +1216,7 @@ class App {
/// Get a display name for an app
CLI11_NODISCARD std::string get_display_name(bool with_aliases = false) const;

/// Check the name, case insensitive and underscore insensitive if set
/// Check the name, case-insensitive and underscore insensitive if set
CLI11_NODISCARD bool check_name(std::string name_to_check) const;

/// Get the groups available directly from this option (in order)
Expand Down
2 changes: 1 addition & 1 deletion include/CLI/Error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ class HorribleError : public ParseError {

// After parsing

/// Thrown when counting a non-existent option
/// Thrown when counting a nonexistent option
class OptionNotFound : public Error {
CLI11_ERROR_DEF(Error, OptionNotFound)
explicit OptionNotFound(std::string name) : OptionNotFound(name + " not found", ExitCodes::OptionNotFound) {}
Expand Down
4 changes: 2 additions & 2 deletions include/CLI/StringTools.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ CLI11_INLINE bool has_escapable_character(const std::string &str);

/// @brief escape all escapable characters
/// @param str the string to escape
/// @return a string with the escapble characters escaped with '\'
/// @return a string with the escapable characters escaped with '\'
CLI11_INLINE std::string add_escaped_characters(const std::string &str);

/// @brief replace the escaped characters with their equivalent
Expand All @@ -261,7 +261,7 @@ CLI11_INLINE std::string extract_binary_string(const std::string &escaped_string
CLI11_INLINE bool process_quoted_string(std::string &str, char string_char = '\"', char literal_char = '\'');

/// This function formats the given text as a paragraph with fixed width and applies correct line wrapping
/// with a custom line prefix. The paragraph will get streamed to the given ostrean.
/// with a custom line prefix. The paragraph will get streamed to the given ostream.
CLI11_INLINE std::ostream &streamOutAsParagraph(std::ostream &out,
const std::string &text,
std::size_t paragraphWidth,
Expand Down
2 changes: 1 addition & 1 deletion include/CLI/TypeTools.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ struct pair_adaptor<
}
};

// Warning is suppressed due to "bug" in gcc<5.0 and gcc 7.0 with c++17 enabled that generates a Wnarrowing warning
// Warning is suppressed due to "bug" in gcc<5.0 and gcc 7.0 with c++17 enabled that generates a -Wnarrowing warning
// in the unevaluated context even if the function that was using this wasn't used. The standard says narrowing in
// brace initialization shouldn't be allowed but for backwards compatibility gcc allows it in some contexts. It is a
// little fuzzy what happens in template constructs and I think that was something GCC took a little while to work out.
Expand Down
2 changes: 1 addition & 1 deletion include/CLI/impl/Config_inl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ inline std::vector<ConfigItem> ConfigBase::from_config(std::istream &input) cons
item = detail::trim_copy(citems.front());
}
if(mlquote) {
// mutliline string
// multiline string
auto keyChar = item.front();
item = buffer.substr(delimiter_pos + 1, std::string::npos);
detail::ltrim(item);
Expand Down
2 changes: 1 addition & 1 deletion single-include/meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Because Meson does not allow outputs to be placed in subfolders, we must have
# meson.build here when generating the single file header so that it is placced
# meson.build here when generating the single file header so that it is placed
# in the correct location.

pymod = import('python')
Expand Down
4 changes: 2 additions & 2 deletions tests/HelpTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ TEST_CASE("THelp: longLineAlignment", "[help]") {
int i{0};

app.add_option("-i,--int,--int_very_long_option_name_that_just_keeps_going_on_and_on_and_on_and_on_and_on_possibly_"
"to_infitinty,--and_another_long_name_just_for_fun",
"to_infinity,--and_another_long_name_just_for_fun",
i,
long_string);

Expand All @@ -820,7 +820,7 @@ TEST_CASE("THelp: longPositional", "[help]") {
int i{0};

app.add_option("int_very_long_option_name_that_just_keeps_going_on_and_on_and_on_and_on_and_on_possibly_"
"to_infitinty",
"to_infinity",
i,
long_string);

Expand Down
6 changes: 3 additions & 3 deletions tests/HelpersTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ TEST_CASE("StringTools: Validation", "[helpers]") {
CHECK_FALSE(CLI::detail::isalpha("test2"));
}

TEST_CASE("StringTools: binaryEscapseConversion", "[helpers]") {
TEST_CASE("StringTools: binaryEscapeConversion", "[helpers]") {
std::string testString("string1");
std::string estring = CLI::detail::binary_escape_string(testString);
CHECK(testString == estring);
Expand Down Expand Up @@ -285,7 +285,7 @@ TEST_CASE("StringTools: binaryEscapseConversion", "[helpers]") {
CHECK(rstring == rstring2);
}

TEST_CASE("StringTools: binaryEscapseConversion2", "[helpers]") {
TEST_CASE("StringTools: binaryEscapeConversion2", "[helpers]") {
std::string testString;
testString.push_back(0);
testString.push_back(0);
Expand Down Expand Up @@ -1345,7 +1345,7 @@ TEST_CASE("Types: TypeNameStrings", "[helpers]") {
auto wsclass = CLI::detail::classify_object<std::wstring>::value;
CHECK(CLI::detail::object_category::wstring_assignable == wsclass);

#if defined CLI11_HAS_FILEYSTEM && CLI11_HAS_FILESYSTEM > 0 && defined(_MSC_VER)
#if defined CLI11_HAS_FILESYSTEM && CLI11_HAS_FILESYSTEM > 0 && defined(_MSC_VER)
auto fspclass = CLI::detail::classify_object<std::filesystem::path>::value;
CHECK(CLI::detail::object_category::wstring_assignable == fspclass);
#endif
Expand Down
4 changes: 2 additions & 2 deletions tests/SubcommandTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2091,7 +2091,7 @@ TEST_CASE_METHOD(TApp, "DotNotationSubcommandSingleChar", "[subcom]") {
CHECK(subs.front()->get_name() == "sub2");
}

TEST_CASE_METHOD(TApp, "DotNotationSubcommandRecusive", "[subcom]") {
TEST_CASE_METHOD(TApp, "DotNotationSubcommandRecursive", "[subcom]") {
std::string v1, v2, v3, vbase;

auto *sub1 = app.add_subcommand("sub1");
Expand Down Expand Up @@ -2119,7 +2119,7 @@ TEST_CASE_METHOD(TApp, "DotNotationSubcommandRecusive", "[subcom]") {
CHECK(extras.front() == "--sub1.sub2.bob");
}

TEST_CASE_METHOD(TApp, "DotNotationSubcommandRecusive2", "[subcom]") {
TEST_CASE_METHOD(TApp, "DotNotationSubcommandRecursive2", "[subcom]") {
std::string v1, v2, v3, vbase;

auto *sub1 = app.add_subcommand("sub1");
Expand Down

0 comments on commit e0511aa

Please sign in to comment.