From a4e5560c5d05bef5dac0c948fb305195c3b8c254 Mon Sep 17 00:00:00 2001 From: ferdymercury Date: Wed, 11 Dec 2024 05:25:21 +0100 Subject: [PATCH 1/3] mention how to install from Linux system packages (#1102) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- book/chapters/installation.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/book/chapters/installation.md b/book/chapters/installation.md index 5ac74339e..f44fe8d6d 100644 --- a/book/chapters/installation.md +++ b/book/chapters/installation.md @@ -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); +} +``` From b71106f870da41934e78fb6ce410a68fc12c5318 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 22 Dec 2024 13:57:27 -0800 Subject: [PATCH 2/3] chore(deps): pre-commit.ci autoupdate (#1104) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- README.md | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0a024bdda..36087e5d5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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] diff --git a/README.md b/README.md index 35dfe18c6..b5b12fdbf 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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][].


@@ -325,8 +325,8 @@ template to directly specify the conversion type. Types such as (std or boost) `optional`, `optional`, and `optional` 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 From ef50bb35c3df00ffd92aad3b1a20fa3e65d6b2f6 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Sun, 22 Dec 2024 17:03:24 -0500 Subject: [PATCH 3/3] 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> --- README.md | 18 +++++++++--------- book/chapters/config.md | 8 ++++---- book/chapters/flags.md | 2 +- book/chapters/subcommands.md | 2 +- cmake/CodeCoverage.cmake | 2 +- docs/Doxyfile | 8 ++++---- examples/CMakeLists.txt | 2 +- include/CLI/App.hpp | 6 +++--- include/CLI/Error.hpp | 2 +- include/CLI/StringTools.hpp | 4 ++-- include/CLI/TypeTools.hpp | 2 +- include/CLI/impl/Config_inl.hpp | 2 +- single-include/meson.build | 2 +- tests/HelpTest.cpp | 4 ++-- tests/HelpersTest.cpp | 6 +++--- tests/SubcommandTest.cpp | 4 ++-- 16 files changed, 37 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index b5b12fdbf..67687824f 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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 @@ -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" @@ -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 @@ -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. @@ -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 diff --git a/book/chapters/config.md b/book/chapters/config.md index 8991bf9ee..a03f7a72d 100644 --- a/book/chapters/config.md +++ b/book/chapters/config.md @@ -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" @@ -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 @@ -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" @@ -175,7 +175,7 @@ python doc strings. ```toml """ -this is a multine +this is a multiline comment """ diff --git a/book/chapters/flags.md b/book/chapters/flags.md index c13180253..9c35d7768 100644 --- a/book/chapters/flags.md +++ b/book/chapters/flags.md @@ -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 diff --git a/book/chapters/subcommands.md b/book/chapters/subcommands.md index 0f621b867..6ab331a26 100644 --- a/book/chapters/subcommands.md +++ b/book/chapters/subcommands.md @@ -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 diff --git a/cmake/CodeCoverage.cmake b/cmake/CodeCoverage.cmake index 28c1cb7e1..3e3d61aac 100644 --- a/cmake/CodeCoverage.cmake +++ b/cmake/CodeCoverage.cmake @@ -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 diff --git a/docs/Doxyfile b/docs/Doxyfile index c86b0ba72..87af5ba1b 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -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 @@ -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. @@ -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. @@ -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. # diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 1173d6b6e..ced9bd9c8 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -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) diff --git a/include/CLI/App.hpp b/include/CLI/App.hpp index f822b4f86..ab543caa3 100644 --- a/include/CLI/App.hpp +++ b/include/CLI/App.hpp @@ -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 @@ -218,7 +218,7 @@ class App { /// Storage for subcommand list std::vector 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 @@ -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) diff --git a/include/CLI/Error.hpp b/include/CLI/Error.hpp index 484de0ed4..29a11e2c0 100644 --- a/include/CLI/Error.hpp +++ b/include/CLI/Error.hpp @@ -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) {} diff --git a/include/CLI/StringTools.hpp b/include/CLI/StringTools.hpp index e2df32fb6..faf07cc6f 100644 --- a/include/CLI/StringTools.hpp +++ b/include/CLI/StringTools.hpp @@ -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 @@ -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, diff --git a/include/CLI/TypeTools.hpp b/include/CLI/TypeTools.hpp index c4fc04188..cbae1631a 100644 --- a/include/CLI/TypeTools.hpp +++ b/include/CLI/TypeTools.hpp @@ -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. diff --git a/include/CLI/impl/Config_inl.hpp b/include/CLI/impl/Config_inl.hpp index 040e7b52b..2485c8fc0 100644 --- a/include/CLI/impl/Config_inl.hpp +++ b/include/CLI/impl/Config_inl.hpp @@ -331,7 +331,7 @@ inline std::vector 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); diff --git a/single-include/meson.build b/single-include/meson.build index 6fe26c504..e889021d7 100644 --- a/single-include/meson.build +++ b/single-include/meson.build @@ -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') diff --git a/tests/HelpTest.cpp b/tests/HelpTest.cpp index 0d9055224..c7965e333 100644 --- a/tests/HelpTest.cpp +++ b/tests/HelpTest.cpp @@ -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); @@ -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); diff --git a/tests/HelpersTest.cpp b/tests/HelpersTest.cpp index 14bab00b7..71dbee305 100644 --- a/tests/HelpersTest.cpp +++ b/tests/HelpersTest.cpp @@ -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); @@ -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); @@ -1345,7 +1345,7 @@ TEST_CASE("Types: TypeNameStrings", "[helpers]") { auto wsclass = CLI::detail::classify_object::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::value; CHECK(CLI::detail::object_category::wstring_assignable == fspclass); #endif diff --git a/tests/SubcommandTest.cpp b/tests/SubcommandTest.cpp index 4d38e4a5b..492a77bab 100644 --- a/tests/SubcommandTest.cpp +++ b/tests/SubcommandTest.cpp @@ -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"); @@ -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");