Commit d8a5bdc294a21bf730faba78d906ff4278d29307
Committed by
GitHub
1 parent
ba68040e
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
Showing
30 changed files
with
170 additions
and
174 deletions
.clang-format
| ... | ... | @@ -75,7 +75,7 @@ SortIncludes: true |
| 75 | 75 | # SpaceBeforeAssignmentOperators: true |
| 76 | 76 | SpaceBeforeParens: Never |
| 77 | 77 | # SpaceInEmptyParentheses: false |
| 78 | -# SpacesBeforeTrailingComments: 1 | |
| 78 | +SpacesBeforeTrailingComments: 2 | |
| 79 | 79 | # SpacesInAngles: false |
| 80 | 80 | # SpacesInContainerLiterals: true |
| 81 | 81 | # SpacesInCStyleCastParentheses: false | ... | ... |
CPPLINT.cfg
| 1 | 1 | set noparent |
| 2 | 2 | linelength=120 # As in .clang-format |
| 3 | 3 | |
| 4 | -# Non-used filters | |
| 4 | +# Unused filters | |
| 5 | 5 | filter=-build/include_order # Requires unusual include order that encourages creating not self-contained headers |
| 6 | 6 | filter=-readability/nolint # Conflicts with clang-tidy |
| 7 | 7 | filter=-runtime/references # Requires fundamental change of API, don't see need for this |
| ... | ... | @@ -9,6 +9,3 @@ filter=-whitespace/blank_line # Unnecessarily strict with blank lines that othe |
| 9 | 9 | filter=-whitespace/indent # Requires strange 3-space indent of private/protected/public markers |
| 10 | 10 | filter=-whitespace/parens,-whitespace/braces # Conflict with clang-format |
| 11 | 11 | |
| 12 | -# Filters to be included in future | |
| 13 | -filter=-whitespace/comments | |
| 14 | - | ... | ... |
examples/groups.cpp
| ... | ... | @@ -20,7 +20,7 @@ int main(int argc, char **argv) { |
| 20 | 20 | int count{0}; |
| 21 | 21 | CLI::Option *copt = app.add_flag("-c,--count", count, "Counter")->required()->group("Important"); |
| 22 | 22 | |
| 23 | - double value{0.0}; // = 3.14; | |
| 23 | + double value{0.0}; // = 3.14; | |
| 24 | 24 | app.add_option("-d,--double", value, "Some Value")->group("Other"); |
| 25 | 25 | |
| 26 | 26 | try { | ... | ... |
examples/nested.cpp
| ... | ... | @@ -14,7 +14,7 @@ int main(int argc, char **argv) { |
| 14 | 14 | app.add_flag("--version", "Get version"); |
| 15 | 15 | |
| 16 | 16 | CLI::App *cameraApp = app.add_subcommand("camera", "Configure the app camera"); |
| 17 | - cameraApp->require_subcommand(0, 1); // 0 (default) or 1 camera | |
| 17 | + cameraApp->require_subcommand(0, 1); // 0 (default) or 1 camera | |
| 18 | 18 | |
| 19 | 19 | std::string mvcamera_config_file = "mvcamera_config.json"; |
| 20 | 20 | CLI::App *mvcameraApp = cameraApp->add_subcommand("mvcamera", "MatrixVision Camera Configuration"); | ... | ... |
examples/simple.cpp
| ... | ... | @@ -21,7 +21,7 @@ int main(int argc, char **argv) { |
| 21 | 21 | int v{0}; |
| 22 | 22 | CLI::Option *flag = app.add_flag("--flag", v, "Some flag that can be passed multiple times"); |
| 23 | 23 | |
| 24 | - double value{0.0}; // = 3.14; | |
| 24 | + double value{0.0}; // = 3.14; | |
| 25 | 25 | app.add_option("-d,--double", value, "Some Value"); |
| 26 | 26 | |
| 27 | 27 | CLI11_PARSE(app, argc, argv); | ... | ... |
examples/subcom_partitioned.cpp
| ... | ... | @@ -23,7 +23,7 @@ int main(int argc, char **argv) { |
| 23 | 23 | CLI::Option *copt = impOpt->add_flag("-c,--count", count, "Counter")->required(); |
| 24 | 24 | |
| 25 | 25 | CLI::App_p otherOpt = std::make_shared<CLI::App>("Other"); |
| 26 | - double value{0.0}; // = 3.14; | |
| 26 | + double value{0.0}; // = 3.14; | |
| 27 | 27 | otherOpt->add_option("-d,--double", value, "Some Value"); |
| 28 | 28 | |
| 29 | 29 | // add the subapps to the main one | ... | ... |
examples/subcommands.cpp
| ... | ... | @@ -15,7 +15,7 @@ int main(int argc, char **argv) { |
| 15 | 15 | app.add_flag("--random", "Some random flag"); |
| 16 | 16 | CLI::App *start = app.add_subcommand("start", "A great subcommand"); |
| 17 | 17 | CLI::App *stop = app.add_subcommand("stop", "Do you really want to stop?"); |
| 18 | - app.require_subcommand(); // 1 or more | |
| 18 | + app.require_subcommand(); // 1 or more | |
| 19 | 19 | |
| 20 | 20 | std::string file; |
| 21 | 21 | start->add_option("-f,--file", file, "File name"); | ... | ... |
include/CLI/App.hpp
| ... | ... | @@ -43,12 +43,12 @@ namespace CLI { |
| 43 | 43 | namespace detail { |
| 44 | 44 | enum class Classifier { NONE, POSITIONAL_MARK, SHORT, LONG, WINDOWS, SUBCOMMAND, SUBCOMMAND_TERMINATOR }; |
| 45 | 45 | struct AppFriend; |
| 46 | -} // namespace detail | |
| 46 | +} // namespace detail | |
| 47 | 47 | |
| 48 | 48 | namespace FailureMessage { |
| 49 | 49 | std::string simple(const App *app, const Error &e); |
| 50 | 50 | std::string help(const App *app, const Error &e); |
| 51 | -} // namespace FailureMessage | |
| 51 | +} // namespace FailureMessage | |
| 52 | 52 | |
| 53 | 53 | /// enumeration of modes of how to deal with extras in config files |
| 54 | 54 | |
| ... | ... | @@ -464,7 +464,7 @@ class App { |
| 464 | 464 | auto *p = (parent_ != nullptr) ? _get_fallthrough_parent() : this; |
| 465 | 465 | auto &match = _compare_subcommand_names(*this, *p); |
| 466 | 466 | if(!match.empty()) { |
| 467 | - ignore_case_ = false; // we are throwing so need to be exception invariant | |
| 467 | + ignore_case_ = false; // we are throwing so need to be exception invariant | |
| 468 | 468 | throw OptionAlreadyAdded("ignore case would cause subcommand name conflicts: " + match); |
| 469 | 469 | } |
| 470 | 470 | } |
| ... | ... | @@ -586,7 +586,7 @@ class App { |
| 586 | 586 | } |
| 587 | 587 | } |
| 588 | 588 | // this line should not be reached the above loop should trigger the throw |
| 589 | - throw(OptionAlreadyAdded("added option matched existing option name")); // LCOV_EXCL_LINE | |
| 589 | + throw(OptionAlreadyAdded("added option matched existing option name")); // LCOV_EXCL_LINE | |
| 590 | 590 | } |
| 591 | 591 | |
| 592 | 592 | /// Add option for assigning to a variable |
| ... | ... | @@ -594,11 +594,11 @@ class App { |
| 594 | 594 | typename ConvertTo = AssignTo, |
| 595 | 595 | enable_if_t<!std::is_const<ConvertTo>::value, detail::enabler> = detail::dummy> |
| 596 | 596 | Option *add_option(std::string option_name, |
| 597 | - AssignTo &variable, ///< The variable to set | |
| 597 | + AssignTo &variable, ///< The variable to set | |
| 598 | 598 | std::string option_description = "", |
| 599 | 599 | bool defaulted = false) { |
| 600 | 600 | |
| 601 | - auto fun = [&variable](const CLI::results_t &res) { // comment for spacing | |
| 601 | + auto fun = [&variable](const CLI::results_t &res) { // comment for spacing | |
| 602 | 602 | return detail::lexical_conversion<AssignTo, ConvertTo>(res, variable); |
| 603 | 603 | }; |
| 604 | 604 | |
| ... | ... | @@ -619,7 +619,7 @@ class App { |
| 619 | 619 | /// Add option for a callback of a specific type |
| 620 | 620 | template <typename T> |
| 621 | 621 | Option *add_option_function(std::string option_name, |
| 622 | - const std::function<void(const T &)> &func, ///< the callback to execute | |
| 622 | + const std::function<void(const T &)> &func, ///< the callback to execute | |
| 623 | 623 | std::string option_description = "") { |
| 624 | 624 | |
| 625 | 625 | auto fun = [func](const CLI::results_t &res) { |
| ... | ... | @@ -731,7 +731,7 @@ class App { |
| 731 | 731 | template <typename T, |
| 732 | 732 | enable_if_t<std::is_integral<T>::value && !is_bool<T>::value, detail::enabler> = detail::dummy> |
| 733 | 733 | Option *add_flag(std::string flag_name, |
| 734 | - T &flag_count, ///< A variable holding the count | |
| 734 | + T &flag_count, ///< A variable holding the count | |
| 735 | 735 | std::string flag_description = "") { |
| 736 | 736 | flag_count = 0; |
| 737 | 737 | CLI::callback_t fun = [&flag_count](const CLI::results_t &res) { |
| ... | ... | @@ -754,7 +754,7 @@ class App { |
| 754 | 754 | !std::is_constructible<std::function<void(int)>, T>::value, |
| 755 | 755 | detail::enabler> = detail::dummy> |
| 756 | 756 | Option *add_flag(std::string flag_name, |
| 757 | - T &flag_result, ///< A variable holding true if passed | |
| 757 | + T &flag_result, ///< A variable holding true if passed | |
| 758 | 758 | std::string flag_description = "") { |
| 759 | 759 | |
| 760 | 760 | CLI::callback_t fun = [&flag_result](const CLI::results_t &res) { |
| ... | ... | @@ -768,7 +768,7 @@ class App { |
| 768 | 768 | typename T, |
| 769 | 769 | enable_if_t<!std::is_assignable<std::function<void(std::int64_t)>, T>::value, detail::enabler> = detail::dummy> |
| 770 | 770 | Option *add_flag(std::string flag_name, |
| 771 | - std::vector<T> &flag_results, ///< A vector of values with the flag results | |
| 771 | + std::vector<T> &flag_results, ///< A vector of values with the flag results | |
| 772 | 772 | std::string flag_description = "") { |
| 773 | 773 | CLI::callback_t fun = [&flag_results](const CLI::results_t &res) { |
| 774 | 774 | bool retval = true; |
| ... | ... | @@ -785,7 +785,7 @@ class App { |
| 785 | 785 | |
| 786 | 786 | /// Add option for callback that is triggered with a true flag and takes no arguments |
| 787 | 787 | Option *add_flag_callback(std::string flag_name, |
| 788 | - std::function<void(void)> function, ///< A function to call, void(void) | |
| 788 | + std::function<void(void)> function, ///< A function to call, void(void) | |
| 789 | 789 | std::string flag_description = "") { |
| 790 | 790 | |
| 791 | 791 | CLI::callback_t fun = [function](const CLI::results_t &res) { |
| ... | ... | @@ -801,7 +801,7 @@ class App { |
| 801 | 801 | |
| 802 | 802 | /// Add option for callback with an integer value |
| 803 | 803 | Option *add_flag_function(std::string flag_name, |
| 804 | - std::function<void(std::int64_t)> function, ///< A function to call, void(int) | |
| 804 | + std::function<void(std::int64_t)> function, ///< A function to call, void(int) | |
| 805 | 805 | std::string flag_description = "") { |
| 806 | 806 | |
| 807 | 807 | CLI::callback_t fun = [function](const CLI::results_t &res) { |
| ... | ... | @@ -817,7 +817,7 @@ class App { |
| 817 | 817 | #ifdef CLI11_CPP14 |
| 818 | 818 | /// Add option for callback (C++14 or better only) |
| 819 | 819 | Option *add_flag(std::string flag_name, |
| 820 | - std::function<void(std::int64_t)> function, ///< A function to call, void(std::int64_t) | |
| 820 | + std::function<void(std::int64_t)> function, ///< A function to call, void(std::int64_t) | |
| 821 | 821 | std::string flag_description = "") { |
| 822 | 822 | return add_flag_function(std::move(flag_name), std::move(function), std::move(flag_description)); |
| 823 | 823 | } |
| ... | ... | @@ -826,8 +826,8 @@ class App { |
| 826 | 826 | /// Add set of options (No default, temp reference, such as an inline set) DEPRECATED |
| 827 | 827 | template <typename T> |
| 828 | 828 | Option *add_set(std::string option_name, |
| 829 | - T &member, ///< The selected member of the set | |
| 830 | - std::set<T> options, ///< The set of possibilities | |
| 829 | + T &member, ///< The selected member of the set | |
| 830 | + std::set<T> options, ///< The set of possibilities | |
| 831 | 831 | std::string option_description = "") { |
| 832 | 832 | |
| 833 | 833 | Option *opt = add_option(option_name, member, std::move(option_description)); |
| ... | ... | @@ -838,8 +838,8 @@ class App { |
| 838 | 838 | /// Add set of options (No default, set can be changed afterwards - do not destroy the set) DEPRECATED |
| 839 | 839 | template <typename T> |
| 840 | 840 | Option *add_mutable_set(std::string option_name, |
| 841 | - T &member, ///< The selected member of the set | |
| 842 | - const std::set<T> &options, ///< The set of possibilities | |
| 841 | + T &member, ///< The selected member of the set | |
| 842 | + const std::set<T> &options, ///< The set of possibilities | |
| 843 | 843 | std::string option_description = "") { |
| 844 | 844 | |
| 845 | 845 | Option *opt = add_option(option_name, member, std::move(option_description)); |
| ... | ... | @@ -850,8 +850,8 @@ class App { |
| 850 | 850 | /// Add set of options (with default, static set, such as an inline set) DEPRECATED |
| 851 | 851 | template <typename T> |
| 852 | 852 | Option *add_set(std::string option_name, |
| 853 | - T &member, ///< The selected member of the set | |
| 854 | - std::set<T> options, ///< The set of possibilities | |
| 853 | + T &member, ///< The selected member of the set | |
| 854 | + std::set<T> options, ///< The set of possibilities | |
| 855 | 855 | std::string option_description, |
| 856 | 856 | bool defaulted) { |
| 857 | 857 | |
| ... | ... | @@ -863,8 +863,8 @@ class App { |
| 863 | 863 | /// Add set of options (with default, set can be changed afterwards - do not destroy the set) DEPRECATED |
| 864 | 864 | template <typename T> |
| 865 | 865 | Option *add_mutable_set(std::string option_name, |
| 866 | - T &member, ///< The selected member of the set | |
| 867 | - const std::set<T> &options, ///< The set of possibilities | |
| 866 | + T &member, ///< The selected member of the set | |
| 867 | + const std::set<T> &options, ///< The set of possibilities | |
| 868 | 868 | std::string option_description, |
| 869 | 869 | bool defaulted) { |
| 870 | 870 | |
| ... | ... | @@ -932,7 +932,7 @@ class App { |
| 932 | 932 | // Remove existing config if present |
| 933 | 933 | if(config_ptr_ != nullptr) { |
| 934 | 934 | remove_option(config_ptr_); |
| 935 | - config_ptr_ = nullptr; // need to remove the config_ptr completely | |
| 935 | + config_ptr_ = nullptr; // need to remove the config_ptr completely | |
| 936 | 936 | } |
| 937 | 937 | |
| 938 | 938 | // Only add config if option passed |
| ... | ... | @@ -1107,7 +1107,7 @@ class App { |
| 1107 | 1107 | for(auto &sub : subcommands_) { |
| 1108 | 1108 | cnt += sub->count_all(); |
| 1109 | 1109 | } |
| 1110 | - if(!get_name().empty()) { // for named subcommands add the number of times the subcommand was called | |
| 1110 | + if(!get_name().empty()) { // for named subcommands add the number of times the subcommand was called | |
| 1111 | 1111 | cnt += parsed_; |
| 1112 | 1112 | } |
| 1113 | 1113 | return cnt; |
| ... | ... | @@ -1881,7 +1881,7 @@ class App { |
| 1881 | 1881 | app->name_.clear(); |
| 1882 | 1882 | } |
| 1883 | 1883 | if(app->name_.empty()) { |
| 1884 | - app->fallthrough_ = false; // make sure fallthrough_ is false to prevent infinite loop | |
| 1884 | + app->fallthrough_ = false; // make sure fallthrough_ is false to prevent infinite loop | |
| 1885 | 1885 | app->prefix_command_ = false; |
| 1886 | 1886 | } |
| 1887 | 1887 | // make sure the parent is set to be this object in preparation for parse |
| ... | ... | @@ -2657,14 +2657,14 @@ class App { |
| 2657 | 2657 | int max_num = op->get_items_expected_max(); |
| 2658 | 2658 | |
| 2659 | 2659 | // Make sure we always eat the minimum for unlimited vectors |
| 2660 | - int collected = 0; // total number of arguments collected | |
| 2661 | - int result_count = 0; // local variable for number of results in a single arg string | |
| 2660 | + int collected = 0; // total number of arguments collected | |
| 2661 | + int result_count = 0; // local variable for number of results in a single arg string | |
| 2662 | 2662 | // deal with purely flag like things |
| 2663 | 2663 | if(max_num == 0) { |
| 2664 | 2664 | auto res = op->get_flag_value(arg_name, value); |
| 2665 | 2665 | op->add_result(res); |
| 2666 | 2666 | parse_order_.push_back(op.get()); |
| 2667 | - } else if(!value.empty()) { // --this=value | |
| 2667 | + } else if(!value.empty()) { // --this=value | |
| 2668 | 2668 | op->add_result(value, result_count); |
| 2669 | 2669 | parse_order_.push_back(op.get()); |
| 2670 | 2670 | collected += result_count; |
| ... | ... | @@ -2685,11 +2685,11 @@ class App { |
| 2685 | 2685 | collected += result_count; |
| 2686 | 2686 | } |
| 2687 | 2687 | |
| 2688 | - if(min_num > collected) { // if we have run out of arguments and the minimum was not met | |
| 2688 | + if(min_num > collected) { // if we have run out of arguments and the minimum was not met | |
| 2689 | 2689 | throw ArgumentMismatch::TypedAtLeast(op->get_name(), min_num, op->get_type_name()); |
| 2690 | 2690 | } |
| 2691 | 2691 | |
| 2692 | - if(max_num > collected || op->get_allow_extra_args()) { // we allow optional arguments | |
| 2692 | + if(max_num > collected || op->get_allow_extra_args()) { // we allow optional arguments | |
| 2693 | 2693 | auto remreqpos = _count_remaining_positionals(true); |
| 2694 | 2694 | // we have met the minimum now optionally check up to the maximum |
| 2695 | 2695 | while((collected < max_num || op->get_allow_extra_args()) && !args.empty() && |
| ... | ... | @@ -2866,7 +2866,7 @@ class App { |
| 2866 | 2866 | throw OptionNotFound("could not locate the given Option"); |
| 2867 | 2867 | } |
| 2868 | 2868 | } |
| 2869 | -}; // namespace CLI | |
| 2869 | +}; // namespace CLI | |
| 2870 | 2870 | |
| 2871 | 2871 | /// Extension of App to better manage groups of options |
| 2872 | 2872 | class Option_group : public App { |
| ... | ... | @@ -3050,7 +3050,7 @@ inline std::string help(const App *app, const Error &e) { |
| 3050 | 3050 | return header; |
| 3051 | 3051 | } |
| 3052 | 3052 | |
| 3053 | -} // namespace FailureMessage | |
| 3053 | +} // namespace FailureMessage | |
| 3054 | 3054 | |
| 3055 | 3055 | namespace detail { |
| 3056 | 3056 | /// This class is simply to allow tests access to App's protected functions |
| ... | ... | @@ -3072,6 +3072,6 @@ struct AppFriend { |
| 3072 | 3072 | /// Wrap the fallthrough parent function to make sure that is working correctly |
| 3073 | 3073 | static App *get_fallthrough_parent(App *app) { return app->_get_fallthrough_parent(); } |
| 3074 | 3074 | }; |
| 3075 | -} // namespace detail | |
| 3075 | +} // namespace detail | |
| 3076 | 3076 | |
| 3077 | -} // namespace CLI | |
| 3077 | +} // namespace CLI | ... | ... |
include/CLI/Config.hpp
| ... | ... | @@ -160,7 +160,7 @@ inline void checkParentSegments(std::vector<ConfigItem> &output, const std::stri |
| 160 | 160 | output.back().parents = std::move(parents); |
| 161 | 161 | output.back().name = "++"; |
| 162 | 162 | } |
| 163 | -} // namespace detail | |
| 163 | +} // namespace detail | |
| 164 | 164 | |
| 165 | 165 | inline std::vector<ConfigItem> ConfigBase::from_config(std::istream &input) const { |
| 166 | 166 | std::string line; |
| ... | ... | @@ -343,4 +343,4 @@ ConfigBase::to_config(const App *app, bool default_also, bool write_description, |
| 343 | 343 | return out.str(); |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | -} // namespace CLI | |
| 346 | +} // namespace CLI | ... | ... |
include/CLI/ConfigFwd.hpp
include/CLI/Error.hpp
include/CLI/Formatter.hpp
| ... | ... | @@ -44,11 +44,11 @@ inline std::string Formatter::make_groups(const App *app, AppFormatMode mode) co |
| 44 | 44 | // Options |
| 45 | 45 | for(const std::string &group : groups) { |
| 46 | 46 | std::vector<const Option *> opts = app->get_options([app, mode, &group](const Option *opt) { |
| 47 | - return opt->get_group() == group // Must be in the right group | |
| 48 | - && opt->nonpositional() // Must not be a positional | |
| 49 | - && (mode != AppFormatMode::Sub // If mode is Sub, then | |
| 50 | - || (app->get_help_ptr() != opt // Ignore help pointer | |
| 51 | - && app->get_help_all_ptr() != opt)); // Ignore help all pointer | |
| 47 | + return opt->get_group() == group // Must be in the right group | |
| 48 | + && opt->nonpositional() // Must not be a positional | |
| 49 | + && (mode != AppFormatMode::Sub // If mode is Sub, then | |
| 50 | + || (app->get_help_ptr() != opt // Ignore help pointer | |
| 51 | + && app->get_help_all_ptr() != opt)); // Ignore help all pointer | |
| 52 | 52 | }); |
| 53 | 53 | if(!group.empty() && !opts.empty()) { |
| 54 | 54 | out << make_group(group, false, opts); |
| ... | ... | @@ -220,7 +220,7 @@ inline std::string Formatter::make_expanded(const App *sub) const { |
| 220 | 220 | |
| 221 | 221 | // Drop blank spaces |
| 222 | 222 | std::string tmp = detail::find_and_replace(out.str(), "\n\n", "\n"); |
| 223 | - tmp = tmp.substr(0, tmp.size() - 1); // Remove the final '\n' | |
| 223 | + tmp = tmp.substr(0, tmp.size() - 1); // Remove the final '\n' | |
| 224 | 224 | |
| 225 | 225 | // Indent all but the first line (the name) |
| 226 | 226 | return detail::find_and_replace(tmp, "\n", "\n ") + "\n"; |
| ... | ... | @@ -278,4 +278,4 @@ inline std::string Formatter::make_option_usage(const Option *opt) const { |
| 278 | 278 | return opt->get_required() ? out.str() : "[" + out.str() + "]"; |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | -} // namespace CLI | |
| 281 | +} // namespace CLI | ... | ... |
include/CLI/FormatterFwd.hpp
| ... | ... | @@ -24,9 +24,9 @@ class App; |
| 24 | 24 | /// the second argument. |
| 25 | 25 | |
| 26 | 26 | enum class AppFormatMode { |
| 27 | - Normal, //< The normal, detailed help | |
| 28 | - All, //< A fully expanded help | |
| 29 | - Sub, //< Used when printed as part of expanded subcommand | |
| 27 | + Normal, //< The normal, detailed help | |
| 28 | + All, //< A fully expanded help | |
| 29 | + Sub, //< Used when printed as part of expanded subcommand | |
| 30 | 30 | }; |
| 31 | 31 | |
| 32 | 32 | /// This is the minimum requirements to run a formatter. |
| ... | ... | @@ -55,7 +55,7 @@ class FormatterBase { |
| 55 | 55 | FormatterBase(FormatterBase &&) = default; |
| 56 | 56 | |
| 57 | 57 | /// Adding a destructor in this form to work around bug in GCC 4.7 |
| 58 | - virtual ~FormatterBase() noexcept {} // NOLINT(modernize-use-equals-default) | |
| 58 | + virtual ~FormatterBase() noexcept {} // NOLINT(modernize-use-equals-default) | |
| 59 | 59 | |
| 60 | 60 | /// This is the key method that puts together help |
| 61 | 61 | virtual std::string make_help(const App *, std::string, AppFormatMode) const = 0; |
| ... | ... | @@ -100,7 +100,7 @@ class FormatterLambda final : public FormatterBase { |
| 100 | 100 | explicit FormatterLambda(funct_t funct) : lambda_(std::move(funct)) {} |
| 101 | 101 | |
| 102 | 102 | /// Adding a destructor (mostly to make GCC 4.7 happy) |
| 103 | - ~FormatterLambda() noexcept override {} // NOLINT(modernize-use-equals-default) | |
| 103 | + ~FormatterLambda() noexcept override {} // NOLINT(modernize-use-equals-default) | |
| 104 | 104 | |
| 105 | 105 | /// This will simply call the lambda function |
| 106 | 106 | std::string make_help(const App *app, std::string name, AppFormatMode mode) const override { |
| ... | ... | @@ -177,4 +177,4 @@ class Formatter : public FormatterBase { |
| 177 | 177 | ///@} |
| 178 | 178 | }; |
| 179 | 179 | |
| 180 | -} // namespace CLI | |
| 180 | +} // namespace CLI | ... | ... |
include/CLI/Option.hpp
| ... | ... | @@ -33,11 +33,11 @@ class App; |
| 33 | 33 | using Option_p = std::unique_ptr<Option>; |
| 34 | 34 | /// Enumeration of the multiOption Policy selection |
| 35 | 35 | enum class MultiOptionPolicy : char { |
| 36 | - Throw, //!< Throw an error if any extra arguments were given | |
| 37 | - TakeLast, //!< take only the last Expected number of arguments | |
| 38 | - TakeFirst, //!< take only the first Expected number of arguments | |
| 39 | - Join, //!< merge all the arguments together into a single string via the delimiter character default('\n') | |
| 40 | - TakeAll //!< just get all the passed argument regardless | |
| 36 | + Throw, //!< Throw an error if any extra arguments were given | |
| 37 | + TakeLast, //!< take only the last Expected number of arguments | |
| 38 | + TakeFirst, //!< take only the first Expected number of arguments | |
| 39 | + Join, //!< merge all the arguments together into a single string via the delimiter character default('\n') | |
| 40 | + TakeAll //!< just get all the passed argument regardless | |
| 41 | 41 | }; |
| 42 | 42 | |
| 43 | 43 | /// This is the CRTP base class for Option and OptionDefaults. It was designed this way |
| ... | ... | @@ -316,10 +316,10 @@ class Option : public OptionBase<Option> { |
| 316 | 316 | results_t proc_results_{}; |
| 317 | 317 | /// enumeration for the option state machine |
| 318 | 318 | enum class option_state { |
| 319 | - parsing = 0, //!< The option is currently collecting parsed results | |
| 320 | - validated = 2, //!< the results have been validated | |
| 321 | - reduced = 4, //!< a subset of results has been generated | |
| 322 | - callback_run = 6, //!< the callback has been executed | |
| 319 | + parsing = 0, //!< The option is currently collecting parsed results | |
| 320 | + validated = 2, //!< the results have been validated | |
| 321 | + reduced = 4, //!< a subset of results has been generated | |
| 322 | + callback_run = 6, //!< the callback has been executed | |
| 323 | 323 | }; |
| 324 | 324 | /// Whether the callback has run (needed for INI parsing) |
| 325 | 325 | option_state current_option_state_{option_state::parsing}; |
| ... | ... | @@ -631,8 +631,8 @@ class Option : public OptionBase<Option> { |
| 631 | 631 | Option *multi_option_policy(MultiOptionPolicy value = MultiOptionPolicy::Throw) { |
| 632 | 632 | if(value != multi_option_policy_) { |
| 633 | 633 | if(multi_option_policy_ == MultiOptionPolicy::Throw && expected_max_ == detail::expected_max_vector_size && |
| 634 | - expected_min_ > 1) { // this bizarre condition is to maintain backwards compatibility | |
| 635 | - // with the previous behavior of expected_ with vectors | |
| 634 | + expected_min_ > 1) { // this bizarre condition is to maintain backwards compatibility | |
| 635 | + // with the previous behavior of expected_ with vectors | |
| 636 | 636 | expected_max_ = expected_min_; |
| 637 | 637 | } |
| 638 | 638 | multi_option_policy_ = value; |
| ... | ... | @@ -727,11 +727,11 @@ class Option : public OptionBase<Option> { |
| 727 | 727 | /// Will include / prefer the positional name if positional is true. |
| 728 | 728 | /// If all_options is false, pick just the most descriptive name to show. |
| 729 | 729 | /// Use `get_name(true)` to get the positional name (replaces `get_pname`) |
| 730 | - std::string get_name(bool positional = false, //<[input] Show the positional name | |
| 731 | - bool all_options = false //<[input] Show every option | |
| 730 | + std::string get_name(bool positional = false, ///< Show the positional name | |
| 731 | + bool all_options = false ///< Show every option | |
| 732 | 732 | ) const { |
| 733 | 733 | if(get_group().empty()) |
| 734 | - return {}; // Hidden | |
| 734 | + return {}; // Hidden | |
| 735 | 735 | |
| 736 | 736 | if(all_options) { |
| 737 | 737 | |
| ... | ... | @@ -822,7 +822,7 @@ class Option : public OptionBase<Option> { |
| 822 | 822 | return lname; |
| 823 | 823 | |
| 824 | 824 | if(ignore_case_ || |
| 825 | - ignore_underscore_) { // We need to do the inverse, in case we are ignore_case or ignore underscore | |
| 825 | + ignore_underscore_) { // We need to do the inverse, in case we are ignore_case or ignore underscore | |
| 826 | 826 | for(const std::string &sname : other.snames_) |
| 827 | 827 | if(check_sname(sname)) |
| 828 | 828 | return sname; |
| ... | ... | @@ -974,7 +974,7 @@ class Option : public OptionBase<Option> { |
| 974 | 974 | results_t res; |
| 975 | 975 | if(results_.empty()) { |
| 976 | 976 | if(!default_str_.empty()) { |
| 977 | - //_add_results takes an rvalue only | |
| 977 | + // _add_results takes an rvalue only | |
| 978 | 978 | _add_result(std::string(default_str_), res); |
| 979 | 979 | _validate_results(res); |
| 980 | 980 | results_t extra; |
| ... | ... | @@ -1090,7 +1090,7 @@ class Option : public OptionBase<Option> { |
| 1090 | 1090 | try { |
| 1091 | 1091 | add_result(val_str); |
| 1092 | 1092 | if(run_callback_for_default_) { |
| 1093 | - run_callback(); // run callback sets the state we need to reset it again | |
| 1093 | + run_callback(); // run callback sets the state we need to reset it again | |
| 1094 | 1094 | current_option_state_ = option_state::parsing; |
| 1095 | 1095 | } else { |
| 1096 | 1096 | _validate_results(results_); |
| ... | ... | @@ -1126,7 +1126,7 @@ class Option : public OptionBase<Option> { |
| 1126 | 1126 | void _validate_results(results_t &res) const { |
| 1127 | 1127 | // Run the Validators (can change the string) |
| 1128 | 1128 | if(!validators_.empty()) { |
| 1129 | - if(type_size_max_ > 1) { // in this context index refers to the index in the type | |
| 1129 | + if(type_size_max_ > 1) { // in this context index refers to the index in the type | |
| 1130 | 1130 | int index = 0; |
| 1131 | 1131 | if(get_items_expected_max() < static_cast<int>(res.size()) && |
| 1132 | 1132 | multi_option_policy_ == CLI::MultiOptionPolicy::TakeLast) { |
| ... | ... | @@ -1136,7 +1136,7 @@ class Option : public OptionBase<Option> { |
| 1136 | 1136 | |
| 1137 | 1137 | for(std::string &result : res) { |
| 1138 | 1138 | if(result.empty() && type_size_max_ != type_size_min_ && index >= 0) { |
| 1139 | - index = 0; // reset index for variable size chunks | |
| 1139 | + index = 0; // reset index for variable size chunks | |
| 1140 | 1140 | continue; |
| 1141 | 1141 | } |
| 1142 | 1142 | auto err_msg = _validate(result, (index >= 0) ? (index % type_size_max_) : index); |
| ... | ... | @@ -1242,7 +1242,7 @@ class Option : public OptionBase<Option> { |
| 1242 | 1242 | int _add_result(std::string &&result, std::vector<std::string> &res) const { |
| 1243 | 1243 | int result_count = 0; |
| 1244 | 1244 | if(allow_extra_args_ && !result.empty() && result.front() == '[' && |
| 1245 | - result.back() == ']') { // this is now a vector string likely from the default or user entry | |
| 1245 | + result.back() == ']') { // this is now a vector string likely from the default or user entry | |
| 1246 | 1246 | result.pop_back(); |
| 1247 | 1247 | |
| 1248 | 1248 | for(auto &var : CLI::detail::split(result.substr(1), ',')) { |
| ... | ... | @@ -1270,6 +1270,6 @@ class Option : public OptionBase<Option> { |
| 1270 | 1270 | } |
| 1271 | 1271 | return result_count; |
| 1272 | 1272 | } |
| 1273 | -}; // namespace CLI | |
| 1273 | +}; // namespace CLI | |
| 1274 | 1274 | |
| 1275 | -} // namespace CLI | |
| 1275 | +} // namespace CLI | ... | ... |
include/CLI/Split.hpp
include/CLI/StringTools.hpp
| ... | ... | @@ -28,7 +28,7 @@ std::ostream &operator<<(std::ostream &in, const T &item) { |
| 28 | 28 | return in << static_cast<typename std::underlying_type<T>::type>(item); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | -} // namespace enums | |
| 31 | +} // namespace enums | |
| 32 | 32 | |
| 33 | 33 | /// Export to CLI namespace |
| 34 | 34 | using enums::operator<<; |
| ... | ... | @@ -298,7 +298,7 @@ inline std::vector<std::string> split_up(std::string str, char delimiter = '\0') |
| 298 | 298 | if(delims.find_first_of(str[0]) != std::string::npos) { |
| 299 | 299 | keyChar = str[0]; |
| 300 | 300 | auto end = str.find_first_of(keyChar, 1); |
| 301 | - while((end != std::string::npos) && (str[end - 1] == '\\')) { // deal with escaped quotes | |
| 301 | + while((end != std::string::npos) && (str[end - 1] == '\\')) { // deal with escaped quotes | |
| 302 | 302 | end = str.find_first_of(keyChar, end + 1); |
| 303 | 303 | embeddedQuote = true; |
| 304 | 304 | } |
| ... | ... | @@ -356,7 +356,7 @@ inline std::size_t escape_detect(std::string &str, std::size_t offset) { |
| 356 | 356 | auto astart = str.find_last_of("-/ \"\'`", offset - 1); |
| 357 | 357 | if(astart != std::string::npos) { |
| 358 | 358 | if(str[astart] == ((str[offset] == '=') ? '-' : '/')) |
| 359 | - str[offset] = ' '; // interpret this as a space so the split_up works properly | |
| 359 | + str[offset] = ' '; // interpret this as a space so the split_up works properly | |
| 360 | 360 | } |
| 361 | 361 | } |
| 362 | 362 | return offset + 1; |
| ... | ... | @@ -374,6 +374,6 @@ inline std::string &add_quotes_if_needed(std::string &str) { |
| 374 | 374 | return str; |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | -} // namespace detail | |
| 377 | +} // namespace detail | |
| 378 | 378 | |
| 379 | -} // namespace CLI | |
| 379 | +} // namespace CLI | ... | ... |
include/CLI/Timer.hpp
| ... | ... | @@ -13,7 +13,7 @@ |
| 13 | 13 | #endif |
| 14 | 14 | |
| 15 | 15 | #include <array> |
| 16 | -#include <chrono> // NOLINT(build/c++11) | |
| 16 | +#include <chrono> // NOLINT(build/c++11) | |
| 17 | 17 | #include <functional> |
| 18 | 18 | #include <iostream> |
| 19 | 19 | #include <string> |
| ... | ... | @@ -128,7 +128,7 @@ class AutoTimer : public Timer { |
| 128 | 128 | ~AutoTimer() { std::cout << to_string() << std::endl; } |
| 129 | 129 | }; |
| 130 | 130 | |
| 131 | -} // namespace CLI | |
| 131 | +} // namespace CLI | |
| 132 | 132 | |
| 133 | 133 | /// This prints out the time if shifted into a std::cout like stream. |
| 134 | 134 | inline std::ostream &operator<<(std::ostream &in, const CLI::Timer &timer) { return in << timer.to_string(); } | ... | ... |
include/CLI/TypeTools.hpp
| ... | ... | @@ -27,7 +27,7 @@ enum class enabler {}; |
| 27 | 27 | |
| 28 | 28 | /// An instance to use in EnableIf |
| 29 | 29 | constexpr enabler dummy = {}; |
| 30 | -} // namespace detail | |
| 30 | +} // namespace detail | |
| 31 | 31 | |
| 32 | 32 | /// A copy of enable_if_t from C++14, compatible with C++11. |
| 33 | 33 | /// |
| ... | ... | @@ -624,7 +624,7 @@ template <typename T, |
| 624 | 624 | enable_if_t<classify_object<T>::value == object_category::unsigned_integral, detail::enabler> = detail::dummy> |
| 625 | 625 | bool lexical_cast(const std::string &input, T &output) { |
| 626 | 626 | if(!input.empty() && input.front() == '-') |
| 627 | - return false; // std::stoull happily converts negative values to junk without any errors. | |
| 627 | + return false; // std::stoull happily converts negative values to junk without any errors. | |
| 628 | 628 | |
| 629 | 629 | try { |
| 630 | 630 | std::size_t n = 0; |
| ... | ... | @@ -804,7 +804,7 @@ bool lexical_assign(const std::string &input, T &output) { |
| 804 | 804 | XC val{}; |
| 805 | 805 | bool parse_result = input.empty() ? true : lexical_cast<XC>(input, val); |
| 806 | 806 | if(parse_result) { |
| 807 | - output = T(val); // use () form of constructor to allow some implicit conversions | |
| 807 | + output = T(val); // use () form of constructor to allow some implicit conversions | |
| 808 | 808 | } |
| 809 | 809 | return parse_result; |
| 810 | 810 | } |
| ... | ... | @@ -1007,5 +1007,5 @@ void sum_flag_vector(const std::vector<std::string> &flags, T &output) { |
| 1007 | 1007 | output = static_cast<T>(count); |
| 1008 | 1008 | } |
| 1009 | 1009 | |
| 1010 | -} // namespace detail | |
| 1011 | -} // namespace CLI | |
| 1010 | +} // namespace detail | |
| 1011 | +} // namespace CLI | ... | ... |
include/CLI/Validators.hpp
| ... | ... | @@ -42,7 +42,7 @@ |
| 42 | 42 | #endif |
| 43 | 43 | |
| 44 | 44 | #if defined CLI11_HAS_FILESYSTEM && CLI11_HAS_FILESYSTEM > 0 |
| 45 | -#include <filesystem> // NOLINT(build/include) | |
| 45 | +#include <filesystem> // NOLINT(build/include) | |
| 46 | 46 | #else |
| 47 | 47 | #include <sys/stat.h> |
| 48 | 48 | #include <sys/types.h> |
| ... | ... | @@ -270,7 +270,7 @@ class Validator { |
| 270 | 270 | return std::string(1, '(') + f1 + ')' + merger + '(' + f2 + ')'; |
| 271 | 271 | }; |
| 272 | 272 | } |
| 273 | -}; // namespace CLI | |
| 273 | +}; // namespace CLI | |
| 274 | 274 | |
| 275 | 275 | /// Class wrapping some of the accessors of Validator |
| 276 | 276 | class CustomValidator : public Validator { |
| ... | ... | @@ -459,7 +459,7 @@ class Number : public Validator { |
| 459 | 459 | } |
| 460 | 460 | }; |
| 461 | 461 | |
| 462 | -} // namespace detail | |
| 462 | +} // namespace detail | |
| 463 | 463 | |
| 464 | 464 | // Static is not needed here, because global const implies static. |
| 465 | 465 | |
| ... | ... | @@ -561,7 +561,7 @@ typename std::remove_reference<T>::type &smart_deref(T &value) { |
| 561 | 561 | /// Generate a string representation of a set |
| 562 | 562 | template <typename T> std::string generate_set(const T &set) { |
| 563 | 563 | using element_t = typename detail::element_type<T>::type; |
| 564 | - using iteration_type_t = typename detail::pair_adaptor<element_t>::value_type; // the type of the object pair | |
| 564 | + using iteration_type_t = typename detail::pair_adaptor<element_t>::value_type; // the type of the object pair | |
| 565 | 565 | std::string out(1, '{'); |
| 566 | 566 | out.append(detail::join( |
| 567 | 567 | detail::smart_deref(set), |
| ... | ... | @@ -574,7 +574,7 @@ template <typename T> std::string generate_set(const T &set) { |
| 574 | 574 | /// Generate a string representation of a map |
| 575 | 575 | template <typename T> std::string generate_map(const T &map, bool key_only = false) { |
| 576 | 576 | using element_t = typename detail::element_type<T>::type; |
| 577 | - using iteration_type_t = typename detail::pair_adaptor<element_t>::value_type; // the type of the object pair | |
| 577 | + using iteration_type_t = typename detail::pair_adaptor<element_t>::value_type; // the type of the object pair | |
| 578 | 578 | std::string out(1, '{'); |
| 579 | 579 | out.append(detail::join( |
| 580 | 580 | detail::smart_deref(map), |
| ... | ... | @@ -685,7 +685,7 @@ typename std::enable_if<std::is_floating_point<T>::value, bool>::type checked_mu |
| 685 | 685 | return true; |
| 686 | 686 | } |
| 687 | 687 | |
| 688 | -} // namespace detail | |
| 688 | +} // namespace detail | |
| 689 | 689 | /// Verify items are in a set |
| 690 | 690 | class IsMember : public Validator { |
| 691 | 691 | public: |
| ... | ... | @@ -705,11 +705,11 @@ class IsMember : public Validator { |
| 705 | 705 | |
| 706 | 706 | // Get the type of the contained item - requires a container have ::value_type |
| 707 | 707 | // if the type does not have first_type and second_type, these are both value_type |
| 708 | - using element_t = typename detail::element_type<T>::type; // Removes (smart) pointers if needed | |
| 709 | - using item_t = typename detail::pair_adaptor<element_t>::first_type; // Is value_type if not a map | |
| 708 | + using element_t = typename detail::element_type<T>::type; // Removes (smart) pointers if needed | |
| 709 | + using item_t = typename detail::pair_adaptor<element_t>::first_type; // Is value_type if not a map | |
| 710 | 710 | |
| 711 | - using local_item_t = typename IsMemberType<item_t>::type; // This will convert bad types to good ones | |
| 712 | - // (const char * to std::string) | |
| 711 | + using local_item_t = typename IsMemberType<item_t>::type; // This will convert bad types to good ones | |
| 712 | + // (const char * to std::string) | |
| 713 | 713 | |
| 714 | 714 | // Make a local copy of the filter function, using a std::function if not one already |
| 715 | 715 | std::function<local_item_t(local_item_t)> filter_fn = filter_function; |
| ... | ... | @@ -722,7 +722,7 @@ class IsMember : public Validator { |
| 722 | 722 | func_ = [set, filter_fn](std::string &input) { |
| 723 | 723 | local_item_t b; |
| 724 | 724 | if(!detail::lexical_cast(input, b)) { |
| 725 | - throw ValidationError(input); // name is added later | |
| 725 | + throw ValidationError(input); // name is added later | |
| 726 | 726 | } |
| 727 | 727 | if(filter_fn) { |
| 728 | 728 | b = filter_fn(b); |
| ... | ... | @@ -778,10 +778,10 @@ class Transformer : public Validator { |
| 778 | 778 | "mapping must produce value pairs"); |
| 779 | 779 | // Get the type of the contained item - requires a container have ::value_type |
| 780 | 780 | // if the type does not have first_type and second_type, these are both value_type |
| 781 | - using element_t = typename detail::element_type<T>::type; // Removes (smart) pointers if needed | |
| 782 | - using item_t = typename detail::pair_adaptor<element_t>::first_type; // Is value_type if not a map | |
| 783 | - using local_item_t = typename IsMemberType<item_t>::type; // This will convert bad types to good ones | |
| 784 | - // (const char * to std::string) | |
| 781 | + using element_t = typename detail::element_type<T>::type; // Removes (smart) pointers if needed | |
| 782 | + using item_t = typename detail::pair_adaptor<element_t>::first_type; // Is value_type if not a map | |
| 783 | + using local_item_t = typename IsMemberType<item_t>::type; // Will convert bad types to good ones | |
| 784 | + // (const char * to std::string) | |
| 785 | 785 | |
| 786 | 786 | // Make a local copy of the filter function, using a std::function if not one already |
| 787 | 787 | std::function<local_item_t(local_item_t)> filter_fn = filter_function; |
| ... | ... | @@ -836,12 +836,11 @@ class CheckedTransformer : public Validator { |
| 836 | 836 | "mapping must produce value pairs"); |
| 837 | 837 | // Get the type of the contained item - requires a container have ::value_type |
| 838 | 838 | // if the type does not have first_type and second_type, these are both value_type |
| 839 | - using element_t = typename detail::element_type<T>::type; // Removes (smart) pointers if needed | |
| 840 | - using item_t = typename detail::pair_adaptor<element_t>::first_type; // Is value_type if not a map | |
| 841 | - using local_item_t = typename IsMemberType<item_t>::type; // This will convert bad types to good ones | |
| 842 | - // (const char * to std::string) | |
| 843 | - using iteration_type_t = typename detail::pair_adaptor<element_t>::value_type; // the type of the object pair // | |
| 844 | - // the type of the object pair | |
| 839 | + using element_t = typename detail::element_type<T>::type; // Removes (smart) pointers if needed | |
| 840 | + using item_t = typename detail::pair_adaptor<element_t>::first_type; // Is value_type if not a map | |
| 841 | + using local_item_t = typename IsMemberType<item_t>::type; // Will convert bad types to good ones | |
| 842 | + // (const char * to std::string) | |
| 843 | + using iteration_type_t = typename detail::pair_adaptor<element_t>::value_type; // the type of the object pair | |
| 845 | 844 | |
| 846 | 845 | // Make a local copy of the filter function, using a std::function if not one already |
| 847 | 846 | std::function<local_item_t(local_item_t)> filter_fn = filter_function; |
| ... | ... | @@ -1125,7 +1124,7 @@ inline std::pair<std::string, std::string> split_program_name(std::string comman |
| 1125 | 1124 | return vals; |
| 1126 | 1125 | } |
| 1127 | 1126 | |
| 1128 | -} // namespace detail | |
| 1127 | +} // namespace detail | |
| 1129 | 1128 | /// @} |
| 1130 | 1129 | |
| 1131 | -} // namespace CLI | |
| 1130 | +} // namespace CLI | ... | ... |
tests/AppTest.cpp
| ... | ... | @@ -684,7 +684,7 @@ TEST_F(TApp, FlagLikeOption) { |
| 684 | 684 | EXPECT_EQ(1u, app.count("--flag")); |
| 685 | 685 | EXPECT_TRUE(val); |
| 686 | 686 | val = false; |
| 687 | - opt->type_size(0, 0); // should be the same as above | |
| 687 | + opt->type_size(0, 0); // should be the same as above | |
| 688 | 688 | EXPECT_EQ(opt->get_type_size_min(), 0); |
| 689 | 689 | EXPECT_EQ(opt->get_type_size_max(), 0); |
| 690 | 690 | run(); |
| ... | ... | @@ -797,7 +797,7 @@ TEST_F(TApp, DefaultOpts) { |
| 797 | 797 | std::string s = "HI"; |
| 798 | 798 | |
| 799 | 799 | app.add_option("-i,i", i); |
| 800 | - app.add_option("-s,s", s)->capture_default_str(); // Used to be different | |
| 800 | + app.add_option("-s,s", s)->capture_default_str(); // Used to be different | |
| 801 | 801 | |
| 802 | 802 | args = {"-i2", "9"}; |
| 803 | 803 | |
| ... | ... | @@ -1191,7 +1191,7 @@ TEST_F(TApp, RequiredPositionalVector) { |
| 1191 | 1191 | // Tests positionals at end |
| 1192 | 1192 | TEST_F(TApp, RequiredPositionalValidation) { |
| 1193 | 1193 | std::vector<std::string> sources; |
| 1194 | - int dest; // required | |
| 1194 | + int dest; // required | |
| 1195 | 1195 | std::string d2; |
| 1196 | 1196 | app.add_option("src", sources); |
| 1197 | 1197 | app.add_option("dest", dest)->required()->check(CLI::PositiveNumber); |
| ... | ... | @@ -1416,7 +1416,7 @@ TEST_F(TApp, NotRequiredExpectedDoubleShort) { |
| 1416 | 1416 | |
| 1417 | 1417 | TEST_F(TApp, RequiredFlags) { |
| 1418 | 1418 | app.add_flag("-a")->required(); |
| 1419 | - app.add_flag("-b")->mandatory(); // Alternate term | |
| 1419 | + app.add_flag("-b")->mandatory(); // Alternate term | |
| 1420 | 1420 | |
| 1421 | 1421 | EXPECT_THROW(run(), CLI::RequiredError); |
| 1422 | 1422 | |
| ... | ... | @@ -1686,7 +1686,7 @@ TEST_F(TApp, RemoveExcludesLinks) { |
| 1686 | 1686 | |
| 1687 | 1687 | args = {"--two"}; |
| 1688 | 1688 | |
| 1689 | - run(); // Mostly hoping it does not crash | |
| 1689 | + run(); // Mostly hoping it does not crash | |
| 1690 | 1690 | } |
| 1691 | 1691 | |
| 1692 | 1692 | TEST_F(TApp, FileNotExists) { |
| ... | ... | @@ -1700,7 +1700,7 @@ TEST_F(TApp, FileNotExists) { |
| 1700 | 1700 | run(); |
| 1701 | 1701 | EXPECT_EQ(myfile, filename); |
| 1702 | 1702 | |
| 1703 | - bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file | |
| 1703 | + bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file | |
| 1704 | 1704 | EXPECT_TRUE(ok); |
| 1705 | 1705 | EXPECT_THROW(run(), CLI::ValidationError); |
| 1706 | 1706 | // deactivate the check, so it should run now |
| ... | ... | @@ -1720,7 +1720,7 @@ TEST_F(TApp, FileExists) { |
| 1720 | 1720 | |
| 1721 | 1721 | EXPECT_THROW(run(), CLI::ValidationError); |
| 1722 | 1722 | |
| 1723 | - bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file | |
| 1723 | + bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file | |
| 1724 | 1724 | EXPECT_TRUE(ok); |
| 1725 | 1725 | run(); |
| 1726 | 1726 | EXPECT_EQ(myfile, filename); |
| ... | ... | @@ -1739,7 +1739,7 @@ TEST_F(TApp, NotFileExists) { |
| 1739 | 1739 | |
| 1740 | 1740 | EXPECT_NO_THROW(run()); |
| 1741 | 1741 | |
| 1742 | - bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file | |
| 1742 | + bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file | |
| 1743 | 1743 | EXPECT_TRUE(ok); |
| 1744 | 1744 | EXPECT_THROW(run(), CLI::ValidationError); |
| 1745 | 1745 | |
| ... | ... | @@ -1749,7 +1749,7 @@ TEST_F(TApp, NotFileExists) { |
| 1749 | 1749 | |
| 1750 | 1750 | TEST_F(TApp, pair_check) { |
| 1751 | 1751 | std::string myfile{"pair_check_file.txt"}; |
| 1752 | - bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file | |
| 1752 | + bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file | |
| 1753 | 1753 | EXPECT_TRUE(ok); |
| 1754 | 1754 | |
| 1755 | 1755 | EXPECT_TRUE(CLI::ExistingFile(myfile).empty()); |
| ... | ... | @@ -1781,7 +1781,7 @@ TEST_F(TApp, pair_check) { |
| 1781 | 1781 | |
| 1782 | 1782 | TEST_F(TApp, pair_check_take_first) { |
| 1783 | 1783 | std::string myfile{"pair_check_file2.txt"}; |
| 1784 | - bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file | |
| 1784 | + bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file | |
| 1785 | 1785 | EXPECT_TRUE(ok); |
| 1786 | 1786 | |
| 1787 | 1787 | EXPECT_TRUE(CLI::ExistingFile(myfile).empty()); |
| ... | ... | @@ -1924,7 +1924,7 @@ TEST_F(TApp, VectorExpectedRange) { |
| 1924 | 1924 | |
| 1925 | 1925 | EXPECT_EQ(opt->get_expected_max(), 4); |
| 1926 | 1926 | EXPECT_EQ(opt->get_expected_min(), 2); |
| 1927 | - opt->expected(4, 2); // just test the handling of reversed arguments | |
| 1927 | + opt->expected(4, 2); // just test the handling of reversed arguments | |
| 1928 | 1928 | EXPECT_EQ(opt->get_expected_max(), 4); |
| 1929 | 1929 | EXPECT_EQ(opt->get_expected_min(), 2); |
| 1930 | 1930 | opt->expected(-5); |
| ... | ... | @@ -2459,7 +2459,7 @@ TEST_F(TApp, vectorPairTypeRange) { |
| 2459 | 2459 | |
| 2460 | 2460 | auto opt = app.add_option("--dict", custom_opt); |
| 2461 | 2461 | |
| 2462 | - opt->type_size(2, 1); // just test switched arguments | |
| 2462 | + opt->type_size(2, 1); // just test switched arguments | |
| 2463 | 2463 | EXPECT_EQ(opt->get_type_size_min(), 1); |
| 2464 | 2464 | EXPECT_EQ(opt->get_type_size_max(), 2); |
| 2465 | 2465 | |
| ... | ... | @@ -2477,7 +2477,7 @@ TEST_F(TApp, vectorPairTypeRange) { |
| 2477 | 2477 | EXPECT_EQ(custom_opt[2].first, -1); |
| 2478 | 2478 | EXPECT_EQ(custom_opt[2].second, "str4"); |
| 2479 | 2479 | |
| 2480 | - opt->type_size(-2, -1); // test negative arguments | |
| 2480 | + opt->type_size(-2, -1); // test negative arguments | |
| 2481 | 2481 | EXPECT_EQ(opt->get_type_size_min(), 1); |
| 2482 | 2482 | EXPECT_EQ(opt->get_type_size_max(), 2); |
| 2483 | 2483 | // this type size spec should run exactly as before | ... | ... |
tests/ConfigFileTest.cpp
| ... | ... | @@ -1045,7 +1045,7 @@ TEST_F(TApp, IniSubcommandMultipleSections) { |
| 1045 | 1045 | EXPECT_EQ(parse_c[0], 68U); |
| 1046 | 1046 | EXPECT_EQ(parse_c[1], 58U); |
| 1047 | 1047 | EXPECT_EQ(subsubcom->count(), 1u); |
| 1048 | - EXPECT_EQ(subcom2->count(), 0u); // not configurable but value is updated | |
| 1048 | + EXPECT_EQ(subcom2->count(), 0u); // not configurable but value is updated | |
| 1049 | 1049 | } |
| 1050 | 1050 | |
| 1051 | 1051 | TEST_F(TApp, DuplicateSubcommandCallbacks) { |
| ... | ... | @@ -1718,7 +1718,7 @@ TEST_F(TApp, StopReadingConfigOnClear) { |
| 1718 | 1718 | TempFile tmpini{"TestIniTmp.ini"}; |
| 1719 | 1719 | |
| 1720 | 1720 | app.set_config("--config", tmpini); |
| 1721 | - auto ptr = app.set_config(); // Should *not* read config file | |
| 1721 | + auto ptr = app.set_config(); // Should *not* read config file | |
| 1722 | 1722 | EXPECT_EQ(ptr, nullptr); |
| 1723 | 1723 | |
| 1724 | 1724 | { | ... | ... |
tests/CreationTest.cpp
| ... | ... | @@ -527,7 +527,7 @@ TEST_F(TApp, GetOptionList) { |
| 527 | 527 | auto flag = app.add_flag("--one"); |
| 528 | 528 | auto opt = app.add_option("--two", two); |
| 529 | 529 | |
| 530 | - const CLI::App &const_app = app; // const alias to force use of const-methods | |
| 530 | + const CLI::App &const_app = app; // const alias to force use of const-methods | |
| 531 | 531 | std::vector<const CLI::Option *> opt_list = const_app.get_options(); |
| 532 | 532 | |
| 533 | 533 | ASSERT_EQ(opt_list.size(), static_cast<std::size_t>(3)); | ... | ... |
tests/HelpTest.cpp
| ... | ... | @@ -715,7 +715,7 @@ TEST(Exit, ExitCodes) { |
| 715 | 715 | EXPECT_EQ(0, app.exit(CLI::CallForHelp())); |
| 716 | 716 | EXPECT_EQ(i, app.exit(CLI::ExtrasError({"Thing"}))); |
| 717 | 717 | EXPECT_EQ(42, app.exit(CLI::RuntimeError(42))); |
| 718 | - EXPECT_EQ(1, app.exit(CLI::RuntimeError())); // Not sure if a default here is a good thing | |
| 718 | + EXPECT_EQ(1, app.exit(CLI::RuntimeError())); // Not sure if a default here is a good thing | |
| 719 | 719 | } |
| 720 | 720 | |
| 721 | 721 | struct CapturedHelp : public ::testing::Test { |
| ... | ... | @@ -945,7 +945,7 @@ TEST(THelp, ValidatorsText) { |
| 945 | 945 | std::string help = app.help(); |
| 946 | 946 | EXPECT_THAT(help, HasSubstr("TEXT:FILE")); |
| 947 | 947 | EXPECT_THAT(help, HasSubstr("INT in [1 - 4]")); |
| 948 | - EXPECT_THAT(help, HasSubstr("UINT:INT in [0 - 12]")); // Loses UINT | |
| 948 | + EXPECT_THAT(help, HasSubstr("UINT:INT in [0 - 12]")); // Loses UINT | |
| 949 | 949 | } |
| 950 | 950 | |
| 951 | 951 | TEST(THelp, ValidatorsTextCustom) { | ... | ... |
tests/HelpersTest.cpp
| ... | ... | @@ -218,7 +218,7 @@ TEST(Trim, TrimCopy) { |
| 218 | 218 | TEST(Validators, FileExists) { |
| 219 | 219 | std::string myfile{"TestFileNotUsed.txt"}; |
| 220 | 220 | EXPECT_FALSE(CLI::ExistingFile(myfile).empty()); |
| 221 | - bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file | |
| 221 | + bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file | |
| 222 | 222 | EXPECT_TRUE(ok); |
| 223 | 223 | EXPECT_TRUE(CLI::ExistingFile(myfile).empty()); |
| 224 | 224 | |
| ... | ... | @@ -229,7 +229,7 @@ TEST(Validators, FileExists) { |
| 229 | 229 | TEST(Validators, FileNotExists) { |
| 230 | 230 | std::string myfile{"TestFileNotUsed.txt"}; |
| 231 | 231 | EXPECT_TRUE(CLI::NonexistentPath(myfile).empty()); |
| 232 | - bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file | |
| 232 | + bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file | |
| 233 | 233 | EXPECT_TRUE(ok); |
| 234 | 234 | EXPECT_FALSE(CLI::NonexistentPath(myfile).empty()); |
| 235 | 235 | |
| ... | ... | @@ -255,7 +255,7 @@ TEST(Validators, DirectoryNotExists) { |
| 255 | 255 | TEST(Validators, DirectoryIsFile) { |
| 256 | 256 | std::string myfile{"TestFileNotUsed.txt"}; |
| 257 | 257 | EXPECT_TRUE(CLI::NonexistentPath(myfile).empty()); |
| 258 | - bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file | |
| 258 | + bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file | |
| 259 | 259 | EXPECT_TRUE(ok); |
| 260 | 260 | EXPECT_FALSE(CLI::ExistingDirectory(myfile).empty()); |
| 261 | 261 | |
| ... | ... | @@ -271,7 +271,7 @@ TEST(Validators, PathExistsDir) { |
| 271 | 271 | TEST(Validators, PathExistsFile) { |
| 272 | 272 | std::string myfile{"TestFileNotUsed.txt"}; |
| 273 | 273 | EXPECT_FALSE(CLI::ExistingPath(myfile).empty()); |
| 274 | - bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file | |
| 274 | + bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file | |
| 275 | 275 | EXPECT_TRUE(ok); |
| 276 | 276 | EXPECT_TRUE(CLI::ExistingPath(myfile).empty()); |
| 277 | 277 | |
| ... | ... | @@ -383,7 +383,7 @@ TEST(Validators, CombinedOrRange) { |
| 383 | 383 | TEST(Validators, CombinedPaths) { |
| 384 | 384 | std::string myfile{"TestFileNotUsed.txt"}; |
| 385 | 385 | EXPECT_FALSE(CLI::ExistingFile(myfile).empty()); |
| 386 | - bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file | |
| 386 | + bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file | |
| 387 | 387 | EXPECT_TRUE(ok); |
| 388 | 388 | |
| 389 | 389 | std::string dir{"../tests"}; |
| ... | ... | @@ -435,7 +435,7 @@ TEST(Validators, ProgramNameSplit) { |
| 435 | 435 | EXPECT_EQ(res.second, "this is a bunch of extra stuff"); |
| 436 | 436 | |
| 437 | 437 | res = CLI::detail::split_program_name("./program_name this is a bunch of extra stuff "); |
| 438 | - EXPECT_EQ(res.first, "./program_name"); // test sectioning of first argument even if it can't detect the file | |
| 438 | + EXPECT_EQ(res.first, "./program_name"); // test sectioning of first argument even if it can't detect the file | |
| 439 | 439 | EXPECT_EQ(res.second, "this is a bunch of extra stuff"); |
| 440 | 440 | |
| 441 | 441 | res = CLI::detail::split_program_name(std::string(" ./") + std::string(myfile) + " "); |
| ... | ... | @@ -663,7 +663,7 @@ TEST(AppHelper, TempfileCreated) { |
| 663 | 663 | |
| 664 | 664 | EXPECT_FALSE(CLI::ExistingFile(myfile).empty()); |
| 665 | 665 | |
| 666 | - bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file | |
| 666 | + bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file | |
| 667 | 667 | EXPECT_TRUE(ok); |
| 668 | 668 | EXPECT_TRUE(CLI::ExistingFile(name).empty()); |
| 669 | 669 | EXPECT_THROW({ TempFile otherfile(name); }, std::runtime_error); |
| ... | ... | @@ -994,12 +994,12 @@ TEST(Types, LexicalCastParsable) { |
| 994 | 994 | |
| 995 | 995 | std::complex<double> output; |
| 996 | 996 | EXPECT_TRUE(CLI::detail::lexical_cast(input, output)); |
| 997 | - EXPECT_DOUBLE_EQ(output.real(), 4.2); // Doing this in one go sometimes has trouble | |
| 998 | - EXPECT_DOUBLE_EQ(output.imag(), 7.3); // on clang + c++4.8 due to missing const | |
| 997 | + EXPECT_DOUBLE_EQ(output.real(), 4.2); // Doing this in one go sometimes has trouble | |
| 998 | + EXPECT_DOUBLE_EQ(output.imag(), 7.3); // on clang + c++4.8 due to missing const | |
| 999 | 999 | |
| 1000 | 1000 | EXPECT_TRUE(CLI::detail::lexical_cast("2.456", output)); |
| 1001 | - EXPECT_DOUBLE_EQ(output.real(), 2.456); // Doing this in one go sometimes has trouble | |
| 1002 | - EXPECT_DOUBLE_EQ(output.imag(), 0.0); // on clang + c++4.8 due to missing const | |
| 1001 | + EXPECT_DOUBLE_EQ(output.real(), 2.456); // Doing this in one go sometimes has trouble | |
| 1002 | + EXPECT_DOUBLE_EQ(output.imag(), 0.0); // on clang + c++4.8 due to missing const | |
| 1003 | 1003 | |
| 1004 | 1004 | EXPECT_FALSE(CLI::detail::lexical_cast(fail_input, output)); |
| 1005 | 1005 | EXPECT_FALSE(CLI::detail::lexical_cast(extra_input, output)); | ... | ... |
tests/NewParseTest.cpp
| ... | ... | @@ -222,8 +222,8 @@ template <> bool lexical_cast<spair>(const std::string &input, spair &output) { |
| 222 | 222 | output = {input.substr(0, sep), input.substr(sep + 1)}; |
| 223 | 223 | return true; |
| 224 | 224 | } |
| 225 | -} // namespace detail | |
| 226 | -} // namespace CLI | |
| 225 | +} // namespace detail | |
| 226 | +} // namespace CLI | |
| 227 | 227 | |
| 228 | 228 | TEST_F(TApp, custom_string_converter) { |
| 229 | 229 | spair val; |
| ... | ... | @@ -295,14 +295,14 @@ template <> bool lexical_cast<std::complex<double>>(const std::string &input, st |
| 295 | 295 | } |
| 296 | 296 | return worked; |
| 297 | 297 | } |
| 298 | -} // namespace detail | |
| 299 | -} // namespace CLI | |
| 298 | +} // namespace detail | |
| 299 | +} // namespace CLI | |
| 300 | 300 | |
| 301 | 301 | TEST_F(TApp, AddingComplexParserDetail) { |
| 302 | 302 | |
| 303 | 303 | bool skip_tests = false; |
| 304 | - try { // check if the library actually supports regex, it is possible to link against a non working regex in the | |
| 305 | - // standard library | |
| 304 | + try { // check if the library actually supports regex, it is possible to link against a non working regex in the | |
| 305 | + // standard library | |
| 306 | 306 | std::smatch m; |
| 307 | 307 | std::string input = "1.5+2.5j"; |
| 308 | 308 | static const std::regex creg( | ... | ... |
tests/OptionGroupTest.cpp
| ... | ... | @@ -768,6 +768,6 @@ TEST_F(ManyGroupsPreTrigger, PreTriggerTestsSubcommand) { |
| 768 | 768 | EXPECT_EQ(triggerMain, 4u); |
| 769 | 769 | EXPECT_EQ(trigger1, 1u); |
| 770 | 770 | EXPECT_EQ(trigger2, 3u); |
| 771 | - EXPECT_EQ(trigger3, 1u); // processes the first argument in group3 which includes the entire subcommand, which will | |
| 772 | - // go until the sub1 command is given | |
| 771 | + EXPECT_EQ(trigger3, 1u); // processes the first argument in group3 which includes the entire subcommand, which will | |
| 772 | + // go until the sub1 command is given | |
| 773 | 773 | } | ... | ... |
tests/SetTest.cpp
| ... | ... | @@ -508,11 +508,11 @@ TEST_F(TApp, InSetIgnoreCase) { |
| 508 | 508 | |
| 509 | 509 | args = {"--quick", "two"}; |
| 510 | 510 | run(); |
| 511 | - EXPECT_EQ("Two", choice); // Keeps caps from set | |
| 511 | + EXPECT_EQ("Two", choice); // Keeps caps from set | |
| 512 | 512 | |
| 513 | 513 | args = {"--quick", "ThrEE"}; |
| 514 | 514 | run(); |
| 515 | - EXPECT_EQ("THREE", choice); // Keeps caps from set | |
| 515 | + EXPECT_EQ("THREE", choice); // Keeps caps from set | |
| 516 | 516 | |
| 517 | 517 | args = {"--quick", "four"}; |
| 518 | 518 | EXPECT_THROW(run(), CLI::ValidationError); |
| ... | ... | @@ -533,11 +533,11 @@ TEST_F(TApp, InSetIgnoreCaseMutableValue) { |
| 533 | 533 | |
| 534 | 534 | args = {"--quick", "two"}; |
| 535 | 535 | run(); |
| 536 | - EXPECT_EQ("Two", choice); // Keeps caps from set | |
| 536 | + EXPECT_EQ("Two", choice); // Keeps caps from set | |
| 537 | 537 | |
| 538 | 538 | args = {"--quick", "ThrEE"}; |
| 539 | 539 | run(); |
| 540 | - EXPECT_EQ("THREE", choice); // Keeps caps from set | |
| 540 | + EXPECT_EQ("THREE", choice); // Keeps caps from set | |
| 541 | 541 | |
| 542 | 542 | options.clear(); |
| 543 | 543 | args = {"--quick", "ThrEE"}; |
| ... | ... | @@ -556,16 +556,16 @@ TEST_F(TApp, InSetIgnoreCasePointer) { |
| 556 | 556 | |
| 557 | 557 | args = {"--quick", "two"}; |
| 558 | 558 | run(); |
| 559 | - EXPECT_EQ("Two", choice); // Keeps caps from set | |
| 559 | + EXPECT_EQ("Two", choice); // Keeps caps from set | |
| 560 | 560 | |
| 561 | 561 | args = {"--quick", "ThrEE"}; |
| 562 | 562 | run(); |
| 563 | - EXPECT_EQ("THREE", choice); // Keeps caps from set | |
| 563 | + EXPECT_EQ("THREE", choice); // Keeps caps from set | |
| 564 | 564 | |
| 565 | 565 | delete options; |
| 566 | 566 | args = {"--quick", "ThrEE"}; |
| 567 | 567 | run(); |
| 568 | - EXPECT_EQ("THREE", choice); // this does not throw a segfault | |
| 568 | + EXPECT_EQ("THREE", choice); // this does not throw a segfault | |
| 569 | 569 | |
| 570 | 570 | args = {"--quick", "four"}; |
| 571 | 571 | EXPECT_THROW(run(), CLI::ValidationError); |
| ... | ... | @@ -600,11 +600,11 @@ TEST_F(TApp, InSetIgnoreUnderscore) { |
| 600 | 600 | |
| 601 | 601 | args = {"--quick", "optiontwo"}; |
| 602 | 602 | run(); |
| 603 | - EXPECT_EQ("option_two", choice); // Keeps underscore from set | |
| 603 | + EXPECT_EQ("option_two", choice); // Keeps underscore from set | |
| 604 | 604 | |
| 605 | 605 | args = {"--quick", "_option_thr_ee"}; |
| 606 | 606 | run(); |
| 607 | - EXPECT_EQ("optionthree", choice); // no underscore | |
| 607 | + EXPECT_EQ("optionthree", choice); // no underscore | |
| 608 | 608 | |
| 609 | 609 | args = {"--quick", "Option4"}; |
| 610 | 610 | EXPECT_THROW(run(), CLI::ValidationError); |
| ... | ... | @@ -626,11 +626,11 @@ TEST_F(TApp, InSetIgnoreCaseUnderscore) { |
| 626 | 626 | |
| 627 | 627 | args = {"--quick", "OptionTwo"}; |
| 628 | 628 | run(); |
| 629 | - EXPECT_EQ("option_two", choice); // Keeps underscore and case from set | |
| 629 | + EXPECT_EQ("option_two", choice); // Keeps underscore and case from set | |
| 630 | 630 | |
| 631 | 631 | args = {"--quick", "_OPTION_thr_ee"}; |
| 632 | 632 | run(); |
| 633 | - EXPECT_EQ("OptionThree", choice); // no underscore | |
| 633 | + EXPECT_EQ("OptionThree", choice); // no underscore | |
| 634 | 634 | |
| 635 | 635 | args = {"--quick", "Option4"}; |
| 636 | 636 | EXPECT_THROW(run(), CLI::ValidationError); | ... | ... |
tests/SubcommandTest.cpp
| ... | ... | @@ -104,7 +104,7 @@ TEST_F(TApp, CrazyNameSubcommand) { |
| 104 | 104 | EXPECT_EQ(sub1->count(), 1u); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | -TEST_F(TApp, RequiredAndSubcommands) { // #23 | |
| 107 | +TEST_F(TApp, RequiredAndSubcommands) { // #23 | |
| 108 | 108 | |
| 109 | 109 | std::string baz; |
| 110 | 110 | app.add_option("baz", baz, "Baz Description", true)->required(); |
| ... | ... | @@ -631,13 +631,13 @@ TEST_F(TApp, CallbackOrderingImmediateMain) { |
| 631 | 631 | EXPECT_EQ(0, sub_val); |
| 632 | 632 | // the main app callback should run before the subcommand callbacks |
| 633 | 633 | app.immediate_callback(); |
| 634 | - val = 0; // reset value | |
| 634 | + val = 0; // reset value | |
| 635 | 635 | run(); |
| 636 | 636 | EXPECT_EQ(2, val); |
| 637 | 637 | EXPECT_EQ(1, sub_val); |
| 638 | 638 | // the subcommand callback now runs immediately after processing and before the main app callback again |
| 639 | 639 | sub->immediate_callback(); |
| 640 | - val = 0; // reset value | |
| 640 | + val = 0; // reset value | |
| 641 | 641 | run(); |
| 642 | 642 | EXPECT_EQ(1, val); |
| 643 | 643 | EXPECT_EQ(0, sub_val); |
| ... | ... | @@ -1213,7 +1213,7 @@ TEST_F(ManySubcommands, Unlimited) { |
| 1213 | 1213 | run(); |
| 1214 | 1214 | EXPECT_EQ(app.remaining(true), vs_t()); |
| 1215 | 1215 | |
| 1216 | - app.require_subcommand(2, 0); // 2 or more | |
| 1216 | + app.require_subcommand(2, 0); // 2 or more | |
| 1217 | 1217 | |
| 1218 | 1218 | run(); |
| 1219 | 1219 | EXPECT_EQ(app.remaining(true), vs_t()); | ... | ... |
tests/TrueFalseTest.cpp
| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | struct TApp_TBO : public TApp, public ::testing::WithParamInterface<const char *> {}; |
| 5 | 5 | |
| 6 | 6 | TEST_P(TApp_TBO, TrueBoolOption) { |
| 7 | - bool value{false}; // Not used, but set just in case | |
| 7 | + bool value{false}; // Not used, but set just in case | |
| 8 | 8 | app.add_option("-b,--bool", value); |
| 9 | 9 | args = {"--bool", GetParam()}; |
| 10 | 10 | run(); |
| ... | ... | @@ -19,7 +19,7 @@ INSTANTIATE_TEST_CASE_P(TrueBoolOptions, TApp_TBO, ::testing::Values("true", "on |
| 19 | 19 | struct TApp_FBO : public TApp, public ::testing::WithParamInterface<const char *> {}; |
| 20 | 20 | |
| 21 | 21 | TEST_P(TApp_FBO, FalseBoolOptions) { |
| 22 | - bool value{true}; // Not used, but set just in case | |
| 22 | + bool value{true}; // Not used, but set just in case | |
| 23 | 23 | app.add_option("-b,--bool", value); |
| 24 | 24 | args = {"--bool", GetParam()}; |
| 25 | 25 | run(); | ... | ... |
tests/app_helper.hpp
| ... | ... | @@ -33,7 +33,7 @@ class TempFile { |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | ~TempFile() { |
| 36 | - std::remove(_name.c_str()); // Doesn't matter if returns 0 or not | |
| 36 | + std::remove(_name.c_str()); // Doesn't matter if returns 0 or not | |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | operator const std::string &() const { return _name; } | ... | ... |