Commit d8a5bdc294a21bf730faba78d906ff4278d29307

Authored by Christoph Bachhuber
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
.clang-format
@@ -75,7 +75,7 @@ SortIncludes: true @@ -75,7 +75,7 @@ SortIncludes: true
75 # SpaceBeforeAssignmentOperators: true 75 # SpaceBeforeAssignmentOperators: true
76 SpaceBeforeParens: Never 76 SpaceBeforeParens: Never
77 # SpaceInEmptyParentheses: false 77 # SpaceInEmptyParentheses: false
78 -# SpacesBeforeTrailingComments: 1 78 +SpacesBeforeTrailingComments: 2
79 # SpacesInAngles: false 79 # SpacesInAngles: false
80 # SpacesInContainerLiterals: true 80 # SpacesInContainerLiterals: true
81 # SpacesInCStyleCastParentheses: false 81 # SpacesInCStyleCastParentheses: false
CPPLINT.cfg
1 set noparent 1 set noparent
2 linelength=120 # As in .clang-format 2 linelength=120 # As in .clang-format
3 3
4 -# Non-used filters 4 +# Unused filters
5 filter=-build/include_order # Requires unusual include order that encourages creating not self-contained headers 5 filter=-build/include_order # Requires unusual include order that encourages creating not self-contained headers
6 filter=-readability/nolint # Conflicts with clang-tidy 6 filter=-readability/nolint # Conflicts with clang-tidy
7 filter=-runtime/references # Requires fundamental change of API, don't see need for this 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,6 +9,3 @@ filter=-whitespace/blank_line # Unnecessarily strict with blank lines that othe
9 filter=-whitespace/indent # Requires strange 3-space indent of private/protected/public markers 9 filter=-whitespace/indent # Requires strange 3-space indent of private/protected/public markers
10 filter=-whitespace/parens,-whitespace/braces # Conflict with clang-format 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,7 +20,7 @@ int main(int argc, char **argv) {
20 int count{0}; 20 int count{0};
21 CLI::Option *copt = app.add_flag("-c,--count", count, "Counter")->required()->group("Important"); 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 app.add_option("-d,--double", value, "Some Value")->group("Other"); 24 app.add_option("-d,--double", value, "Some Value")->group("Other");
25 25
26 try { 26 try {
examples/nested.cpp
@@ -14,7 +14,7 @@ int main(int argc, char **argv) { @@ -14,7 +14,7 @@ int main(int argc, char **argv) {
14 app.add_flag("--version", "Get version"); 14 app.add_flag("--version", "Get version");
15 15
16 CLI::App *cameraApp = app.add_subcommand("camera", "Configure the app camera"); 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 std::string mvcamera_config_file = "mvcamera_config.json"; 19 std::string mvcamera_config_file = "mvcamera_config.json";
20 CLI::App *mvcameraApp = cameraApp->add_subcommand("mvcamera", "MatrixVision Camera Configuration"); 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,7 +21,7 @@ int main(int argc, char **argv) {
21 int v{0}; 21 int v{0};
22 CLI::Option *flag = app.add_flag("--flag", v, "Some flag that can be passed multiple times"); 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 app.add_option("-d,--double", value, "Some Value"); 25 app.add_option("-d,--double", value, "Some Value");
26 26
27 CLI11_PARSE(app, argc, argv); 27 CLI11_PARSE(app, argc, argv);
examples/subcom_partitioned.cpp
@@ -23,7 +23,7 @@ int main(int argc, char **argv) { @@ -23,7 +23,7 @@ int main(int argc, char **argv) {
23 CLI::Option *copt = impOpt->add_flag("-c,--count", count, "Counter")->required(); 23 CLI::Option *copt = impOpt->add_flag("-c,--count", count, "Counter")->required();
24 24
25 CLI::App_p otherOpt = std::make_shared<CLI::App>("Other"); 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 otherOpt->add_option("-d,--double", value, "Some Value"); 27 otherOpt->add_option("-d,--double", value, "Some Value");
28 28
29 // add the subapps to the main one 29 // add the subapps to the main one
examples/subcommands.cpp
@@ -15,7 +15,7 @@ int main(int argc, char **argv) { @@ -15,7 +15,7 @@ int main(int argc, char **argv) {
15 app.add_flag("--random", "Some random flag"); 15 app.add_flag("--random", "Some random flag");
16 CLI::App *start = app.add_subcommand("start", "A great subcommand"); 16 CLI::App *start = app.add_subcommand("start", "A great subcommand");
17 CLI::App *stop = app.add_subcommand("stop", "Do you really want to stop?"); 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 std::string file; 20 std::string file;
21 start->add_option("-f,--file", file, "File name"); 21 start->add_option("-f,--file", file, "File name");
include/CLI/App.hpp
@@ -43,12 +43,12 @@ namespace CLI { @@ -43,12 +43,12 @@ namespace CLI {
43 namespace detail { 43 namespace detail {
44 enum class Classifier { NONE, POSITIONAL_MARK, SHORT, LONG, WINDOWS, SUBCOMMAND, SUBCOMMAND_TERMINATOR }; 44 enum class Classifier { NONE, POSITIONAL_MARK, SHORT, LONG, WINDOWS, SUBCOMMAND, SUBCOMMAND_TERMINATOR };
45 struct AppFriend; 45 struct AppFriend;
46 -} // namespace detail 46 +} // namespace detail
47 47
48 namespace FailureMessage { 48 namespace FailureMessage {
49 std::string simple(const App *app, const Error &e); 49 std::string simple(const App *app, const Error &e);
50 std::string help(const App *app, const Error &e); 50 std::string help(const App *app, const Error &e);
51 -} // namespace FailureMessage 51 +} // namespace FailureMessage
52 52
53 /// enumeration of modes of how to deal with extras in config files 53 /// enumeration of modes of how to deal with extras in config files
54 54
@@ -464,7 +464,7 @@ class App { @@ -464,7 +464,7 @@ class App {
464 auto *p = (parent_ != nullptr) ? _get_fallthrough_parent() : this; 464 auto *p = (parent_ != nullptr) ? _get_fallthrough_parent() : this;
465 auto &match = _compare_subcommand_names(*this, *p); 465 auto &match = _compare_subcommand_names(*this, *p);
466 if(!match.empty()) { 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 throw OptionAlreadyAdded("ignore case would cause subcommand name conflicts: " + match); 468 throw OptionAlreadyAdded("ignore case would cause subcommand name conflicts: " + match);
469 } 469 }
470 } 470 }
@@ -586,7 +586,7 @@ class App { @@ -586,7 +586,7 @@ class App {
586 } 586 }
587 } 587 }
588 // this line should not be reached the above loop should trigger the throw 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 /// Add option for assigning to a variable 592 /// Add option for assigning to a variable
@@ -594,11 +594,11 @@ class App { @@ -594,11 +594,11 @@ class App {
594 typename ConvertTo = AssignTo, 594 typename ConvertTo = AssignTo,
595 enable_if_t<!std::is_const<ConvertTo>::value, detail::enabler> = detail::dummy> 595 enable_if_t<!std::is_const<ConvertTo>::value, detail::enabler> = detail::dummy>
596 Option *add_option(std::string option_name, 596 Option *add_option(std::string option_name,
597 - AssignTo &variable, ///< The variable to set 597 + AssignTo &variable, ///< The variable to set
598 std::string option_description = "", 598 std::string option_description = "",
599 bool defaulted = false) { 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 return detail::lexical_conversion<AssignTo, ConvertTo>(res, variable); 602 return detail::lexical_conversion<AssignTo, ConvertTo>(res, variable);
603 }; 603 };
604 604
@@ -619,7 +619,7 @@ class App { @@ -619,7 +619,7 @@ class App {
619 /// Add option for a callback of a specific type 619 /// Add option for a callback of a specific type
620 template <typename T> 620 template <typename T>
621 Option *add_option_function(std::string option_name, 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 std::string option_description = "") { 623 std::string option_description = "") {
624 624
625 auto fun = [func](const CLI::results_t &res) { 625 auto fun = [func](const CLI::results_t &res) {
@@ -731,7 +731,7 @@ class App { @@ -731,7 +731,7 @@ class App {
731 template <typename T, 731 template <typename T,
732 enable_if_t<std::is_integral<T>::value && !is_bool<T>::value, detail::enabler> = detail::dummy> 732 enable_if_t<std::is_integral<T>::value && !is_bool<T>::value, detail::enabler> = detail::dummy>
733 Option *add_flag(std::string flag_name, 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 std::string flag_description = "") { 735 std::string flag_description = "") {
736 flag_count = 0; 736 flag_count = 0;
737 CLI::callback_t fun = [&flag_count](const CLI::results_t &res) { 737 CLI::callback_t fun = [&flag_count](const CLI::results_t &res) {
@@ -754,7 +754,7 @@ class App { @@ -754,7 +754,7 @@ class App {
754 !std::is_constructible<std::function<void(int)>, T>::value, 754 !std::is_constructible<std::function<void(int)>, T>::value,
755 detail::enabler> = detail::dummy> 755 detail::enabler> = detail::dummy>
756 Option *add_flag(std::string flag_name, 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 std::string flag_description = "") { 758 std::string flag_description = "") {
759 759
760 CLI::callback_t fun = [&flag_result](const CLI::results_t &res) { 760 CLI::callback_t fun = [&flag_result](const CLI::results_t &res) {
@@ -768,7 +768,7 @@ class App { @@ -768,7 +768,7 @@ class App {
768 typename T, 768 typename T,
769 enable_if_t<!std::is_assignable<std::function<void(std::int64_t)>, T>::value, detail::enabler> = detail::dummy> 769 enable_if_t<!std::is_assignable<std::function<void(std::int64_t)>, T>::value, detail::enabler> = detail::dummy>
770 Option *add_flag(std::string flag_name, 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 std::string flag_description = "") { 772 std::string flag_description = "") {
773 CLI::callback_t fun = [&flag_results](const CLI::results_t &res) { 773 CLI::callback_t fun = [&flag_results](const CLI::results_t &res) {
774 bool retval = true; 774 bool retval = true;
@@ -785,7 +785,7 @@ class App { @@ -785,7 +785,7 @@ class App {
785 785
786 /// Add option for callback that is triggered with a true flag and takes no arguments 786 /// Add option for callback that is triggered with a true flag and takes no arguments
787 Option *add_flag_callback(std::string flag_name, 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 std::string flag_description = "") { 789 std::string flag_description = "") {
790 790
791 CLI::callback_t fun = [function](const CLI::results_t &res) { 791 CLI::callback_t fun = [function](const CLI::results_t &res) {
@@ -801,7 +801,7 @@ class App { @@ -801,7 +801,7 @@ class App {
801 801
802 /// Add option for callback with an integer value 802 /// Add option for callback with an integer value
803 Option *add_flag_function(std::string flag_name, 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 std::string flag_description = "") { 805 std::string flag_description = "") {
806 806
807 CLI::callback_t fun = [function](const CLI::results_t &res) { 807 CLI::callback_t fun = [function](const CLI::results_t &res) {
@@ -817,7 +817,7 @@ class App { @@ -817,7 +817,7 @@ class App {
817 #ifdef CLI11_CPP14 817 #ifdef CLI11_CPP14
818 /// Add option for callback (C++14 or better only) 818 /// Add option for callback (C++14 or better only)
819 Option *add_flag(std::string flag_name, 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 std::string flag_description = "") { 821 std::string flag_description = "") {
822 return add_flag_function(std::move(flag_name), std::move(function), std::move(flag_description)); 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,8 +826,8 @@ class App {
826 /// Add set of options (No default, temp reference, such as an inline set) DEPRECATED 826 /// Add set of options (No default, temp reference, such as an inline set) DEPRECATED
827 template <typename T> 827 template <typename T>
828 Option *add_set(std::string option_name, 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 std::string option_description = "") { 831 std::string option_description = "") {
832 832
833 Option *opt = add_option(option_name, member, std::move(option_description)); 833 Option *opt = add_option(option_name, member, std::move(option_description));
@@ -838,8 +838,8 @@ class App { @@ -838,8 +838,8 @@ class App {
838 /// Add set of options (No default, set can be changed afterwards - do not destroy the set) DEPRECATED 838 /// Add set of options (No default, set can be changed afterwards - do not destroy the set) DEPRECATED
839 template <typename T> 839 template <typename T>
840 Option *add_mutable_set(std::string option_name, 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 std::string option_description = "") { 843 std::string option_description = "") {
844 844
845 Option *opt = add_option(option_name, member, std::move(option_description)); 845 Option *opt = add_option(option_name, member, std::move(option_description));
@@ -850,8 +850,8 @@ class App { @@ -850,8 +850,8 @@ class App {
850 /// Add set of options (with default, static set, such as an inline set) DEPRECATED 850 /// Add set of options (with default, static set, such as an inline set) DEPRECATED
851 template <typename T> 851 template <typename T>
852 Option *add_set(std::string option_name, 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 std::string option_description, 855 std::string option_description,
856 bool defaulted) { 856 bool defaulted) {
857 857
@@ -863,8 +863,8 @@ class App { @@ -863,8 +863,8 @@ class App {
863 /// Add set of options (with default, set can be changed afterwards - do not destroy the set) DEPRECATED 863 /// Add set of options (with default, set can be changed afterwards - do not destroy the set) DEPRECATED
864 template <typename T> 864 template <typename T>
865 Option *add_mutable_set(std::string option_name, 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 std::string option_description, 868 std::string option_description,
869 bool defaulted) { 869 bool defaulted) {
870 870
@@ -932,7 +932,7 @@ class App { @@ -932,7 +932,7 @@ class App {
932 // Remove existing config if present 932 // Remove existing config if present
933 if(config_ptr_ != nullptr) { 933 if(config_ptr_ != nullptr) {
934 remove_option(config_ptr_); 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 // Only add config if option passed 938 // Only add config if option passed
@@ -1107,7 +1107,7 @@ class App { @@ -1107,7 +1107,7 @@ class App {
1107 for(auto &sub : subcommands_) { 1107 for(auto &sub : subcommands_) {
1108 cnt += sub->count_all(); 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 cnt += parsed_; 1111 cnt += parsed_;
1112 } 1112 }
1113 return cnt; 1113 return cnt;
@@ -1881,7 +1881,7 @@ class App { @@ -1881,7 +1881,7 @@ class App {
1881 app->name_.clear(); 1881 app->name_.clear();
1882 } 1882 }
1883 if(app->name_.empty()) { 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 app->prefix_command_ = false; 1885 app->prefix_command_ = false;
1886 } 1886 }
1887 // make sure the parent is set to be this object in preparation for parse 1887 // make sure the parent is set to be this object in preparation for parse
@@ -2657,14 +2657,14 @@ class App { @@ -2657,14 +2657,14 @@ class App {
2657 int max_num = op->get_items_expected_max(); 2657 int max_num = op->get_items_expected_max();
2658 2658
2659 // Make sure we always eat the minimum for unlimited vectors 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 // deal with purely flag like things 2662 // deal with purely flag like things
2663 if(max_num == 0) { 2663 if(max_num == 0) {
2664 auto res = op->get_flag_value(arg_name, value); 2664 auto res = op->get_flag_value(arg_name, value);
2665 op->add_result(res); 2665 op->add_result(res);
2666 parse_order_.push_back(op.get()); 2666 parse_order_.push_back(op.get());
2667 - } else if(!value.empty()) { // --this=value 2667 + } else if(!value.empty()) { // --this=value
2668 op->add_result(value, result_count); 2668 op->add_result(value, result_count);
2669 parse_order_.push_back(op.get()); 2669 parse_order_.push_back(op.get());
2670 collected += result_count; 2670 collected += result_count;
@@ -2685,11 +2685,11 @@ class App { @@ -2685,11 +2685,11 @@ class App {
2685 collected += result_count; 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 throw ArgumentMismatch::TypedAtLeast(op->get_name(), min_num, op->get_type_name()); 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 auto remreqpos = _count_remaining_positionals(true); 2693 auto remreqpos = _count_remaining_positionals(true);
2694 // we have met the minimum now optionally check up to the maximum 2694 // we have met the minimum now optionally check up to the maximum
2695 while((collected < max_num || op->get_allow_extra_args()) && !args.empty() && 2695 while((collected < max_num || op->get_allow_extra_args()) && !args.empty() &&
@@ -2866,7 +2866,7 @@ class App { @@ -2866,7 +2866,7 @@ class App {
2866 throw OptionNotFound("could not locate the given Option"); 2866 throw OptionNotFound("could not locate the given Option");
2867 } 2867 }
2868 } 2868 }
2869 -}; // namespace CLI 2869 +}; // namespace CLI
2870 2870
2871 /// Extension of App to better manage groups of options 2871 /// Extension of App to better manage groups of options
2872 class Option_group : public App { 2872 class Option_group : public App {
@@ -3050,7 +3050,7 @@ inline std::string help(const App *app, const Error &amp;e) { @@ -3050,7 +3050,7 @@ inline std::string help(const App *app, const Error &amp;e) {
3050 return header; 3050 return header;
3051 } 3051 }
3052 3052
3053 -} // namespace FailureMessage 3053 +} // namespace FailureMessage
3054 3054
3055 namespace detail { 3055 namespace detail {
3056 /// This class is simply to allow tests access to App's protected functions 3056 /// This class is simply to allow tests access to App's protected functions
@@ -3072,6 +3072,6 @@ struct AppFriend { @@ -3072,6 +3072,6 @@ struct AppFriend {
3072 /// Wrap the fallthrough parent function to make sure that is working correctly 3072 /// Wrap the fallthrough parent function to make sure that is working correctly
3073 static App *get_fallthrough_parent(App *app) { return app->_get_fallthrough_parent(); } 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&lt;ConfigItem&gt; &amp;output, const std::stri @@ -160,7 +160,7 @@ inline void checkParentSegments(std::vector&lt;ConfigItem&gt; &amp;output, const std::stri
160 output.back().parents = std::move(parents); 160 output.back().parents = std::move(parents);
161 output.back().name = "++"; 161 output.back().name = "++";
162 } 162 }
163 -} // namespace detail 163 +} // namespace detail
164 164
165 inline std::vector<ConfigItem> ConfigBase::from_config(std::istream &input) const { 165 inline std::vector<ConfigItem> ConfigBase::from_config(std::istream &input) const {
166 std::string line; 166 std::string line;
@@ -343,4 +343,4 @@ ConfigBase::to_config(const App *app, bool default_also, bool write_description, @@ -343,4 +343,4 @@ ConfigBase::to_config(const App *app, bool default_also, bool write_description,
343 return out.str(); 343 return out.str();
344 } 344 }
345 345
346 -} // namespace CLI 346 +} // namespace CLI
include/CLI/ConfigFwd.hpp
@@ -128,4 +128,4 @@ class ConfigTOML : public ConfigINI { @@ -128,4 +128,4 @@ class ConfigTOML : public ConfigINI {
128 valueDelimiter = '='; 128 valueDelimiter = '=';
129 } 129 }
130 }; 130 };
131 -} // namespace CLI 131 +} // namespace CLI
include/CLI/Error.hpp
@@ -337,4 +337,4 @@ class OptionNotFound : public Error { @@ -337,4 +337,4 @@ class OptionNotFound : public Error {
337 337
338 /// @} 338 /// @}
339 339
340 -} // namespace CLI 340 +} // namespace CLI
include/CLI/Formatter.hpp
@@ -44,11 +44,11 @@ inline std::string Formatter::make_groups(const App *app, AppFormatMode mode) co @@ -44,11 +44,11 @@ inline std::string Formatter::make_groups(const App *app, AppFormatMode mode) co
44 // Options 44 // Options
45 for(const std::string &group : groups) { 45 for(const std::string &group : groups) {
46 std::vector<const Option *> opts = app->get_options([app, mode, &group](const Option *opt) { 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 if(!group.empty() && !opts.empty()) { 53 if(!group.empty() && !opts.empty()) {
54 out << make_group(group, false, opts); 54 out << make_group(group, false, opts);
@@ -220,7 +220,7 @@ inline std::string Formatter::make_expanded(const App *sub) const { @@ -220,7 +220,7 @@ inline std::string Formatter::make_expanded(const App *sub) const {
220 220
221 // Drop blank spaces 221 // Drop blank spaces
222 std::string tmp = detail::find_and_replace(out.str(), "\n\n", "\n"); 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 // Indent all but the first line (the name) 225 // Indent all but the first line (the name)
226 return detail::find_and_replace(tmp, "\n", "\n ") + "\n"; 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,4 +278,4 @@ inline std::string Formatter::make_option_usage(const Option *opt) const {
278 return opt->get_required() ? out.str() : "[" + out.str() + "]"; 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,9 +24,9 @@ class App;
24 /// the second argument. 24 /// the second argument.
25 25
26 enum class AppFormatMode { 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 /// This is the minimum requirements to run a formatter. 32 /// This is the minimum requirements to run a formatter.
@@ -55,7 +55,7 @@ class FormatterBase { @@ -55,7 +55,7 @@ class FormatterBase {
55 FormatterBase(FormatterBase &&) = default; 55 FormatterBase(FormatterBase &&) = default;
56 56
57 /// Adding a destructor in this form to work around bug in GCC 4.7 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 /// This is the key method that puts together help 60 /// This is the key method that puts together help
61 virtual std::string make_help(const App *, std::string, AppFormatMode) const = 0; 61 virtual std::string make_help(const App *, std::string, AppFormatMode) const = 0;
@@ -100,7 +100,7 @@ class FormatterLambda final : public FormatterBase { @@ -100,7 +100,7 @@ class FormatterLambda final : public FormatterBase {
100 explicit FormatterLambda(funct_t funct) : lambda_(std::move(funct)) {} 100 explicit FormatterLambda(funct_t funct) : lambda_(std::move(funct)) {}
101 101
102 /// Adding a destructor (mostly to make GCC 4.7 happy) 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 /// This will simply call the lambda function 105 /// This will simply call the lambda function
106 std::string make_help(const App *app, std::string name, AppFormatMode mode) const override { 106 std::string make_help(const App *app, std::string name, AppFormatMode mode) const override {
@@ -177,4 +177,4 @@ class Formatter : public FormatterBase { @@ -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,11 +33,11 @@ class App;
33 using Option_p = std::unique_ptr<Option>; 33 using Option_p = std::unique_ptr<Option>;
34 /// Enumeration of the multiOption Policy selection 34 /// Enumeration of the multiOption Policy selection
35 enum class MultiOptionPolicy : char { 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 /// This is the CRTP base class for Option and OptionDefaults. It was designed this way 43 /// This is the CRTP base class for Option and OptionDefaults. It was designed this way
@@ -316,10 +316,10 @@ class Option : public OptionBase&lt;Option&gt; { @@ -316,10 +316,10 @@ class Option : public OptionBase&lt;Option&gt; {
316 results_t proc_results_{}; 316 results_t proc_results_{};
317 /// enumeration for the option state machine 317 /// enumeration for the option state machine
318 enum class option_state { 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 /// Whether the callback has run (needed for INI parsing) 324 /// Whether the callback has run (needed for INI parsing)
325 option_state current_option_state_{option_state::parsing}; 325 option_state current_option_state_{option_state::parsing};
@@ -631,8 +631,8 @@ class Option : public OptionBase&lt;Option&gt; { @@ -631,8 +631,8 @@ class Option : public OptionBase&lt;Option&gt; {
631 Option *multi_option_policy(MultiOptionPolicy value = MultiOptionPolicy::Throw) { 631 Option *multi_option_policy(MultiOptionPolicy value = MultiOptionPolicy::Throw) {
632 if(value != multi_option_policy_) { 632 if(value != multi_option_policy_) {
633 if(multi_option_policy_ == MultiOptionPolicy::Throw && expected_max_ == detail::expected_max_vector_size && 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 expected_max_ = expected_min_; 636 expected_max_ = expected_min_;
637 } 637 }
638 multi_option_policy_ = value; 638 multi_option_policy_ = value;
@@ -727,11 +727,11 @@ class Option : public OptionBase&lt;Option&gt; { @@ -727,11 +727,11 @@ class Option : public OptionBase&lt;Option&gt; {
727 /// Will include / prefer the positional name if positional is true. 727 /// Will include / prefer the positional name if positional is true.
728 /// If all_options is false, pick just the most descriptive name to show. 728 /// If all_options is false, pick just the most descriptive name to show.
729 /// Use `get_name(true)` to get the positional name (replaces `get_pname`) 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 ) const { 732 ) const {
733 if(get_group().empty()) 733 if(get_group().empty())
734 - return {}; // Hidden 734 + return {}; // Hidden
735 735
736 if(all_options) { 736 if(all_options) {
737 737
@@ -822,7 +822,7 @@ class Option : public OptionBase&lt;Option&gt; { @@ -822,7 +822,7 @@ class Option : public OptionBase&lt;Option&gt; {
822 return lname; 822 return lname;
823 823
824 if(ignore_case_ || 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 for(const std::string &sname : other.snames_) 826 for(const std::string &sname : other.snames_)
827 if(check_sname(sname)) 827 if(check_sname(sname))
828 return sname; 828 return sname;
@@ -974,7 +974,7 @@ class Option : public OptionBase&lt;Option&gt; { @@ -974,7 +974,7 @@ class Option : public OptionBase&lt;Option&gt; {
974 results_t res; 974 results_t res;
975 if(results_.empty()) { 975 if(results_.empty()) {
976 if(!default_str_.empty()) { 976 if(!default_str_.empty()) {
977 - //_add_results takes an rvalue only 977 + // _add_results takes an rvalue only
978 _add_result(std::string(default_str_), res); 978 _add_result(std::string(default_str_), res);
979 _validate_results(res); 979 _validate_results(res);
980 results_t extra; 980 results_t extra;
@@ -1090,7 +1090,7 @@ class Option : public OptionBase&lt;Option&gt; { @@ -1090,7 +1090,7 @@ class Option : public OptionBase&lt;Option&gt; {
1090 try { 1090 try {
1091 add_result(val_str); 1091 add_result(val_str);
1092 if(run_callback_for_default_) { 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 current_option_state_ = option_state::parsing; 1094 current_option_state_ = option_state::parsing;
1095 } else { 1095 } else {
1096 _validate_results(results_); 1096 _validate_results(results_);
@@ -1126,7 +1126,7 @@ class Option : public OptionBase&lt;Option&gt; { @@ -1126,7 +1126,7 @@ class Option : public OptionBase&lt;Option&gt; {
1126 void _validate_results(results_t &res) const { 1126 void _validate_results(results_t &res) const {
1127 // Run the Validators (can change the string) 1127 // Run the Validators (can change the string)
1128 if(!validators_.empty()) { 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 int index = 0; 1130 int index = 0;
1131 if(get_items_expected_max() < static_cast<int>(res.size()) && 1131 if(get_items_expected_max() < static_cast<int>(res.size()) &&
1132 multi_option_policy_ == CLI::MultiOptionPolicy::TakeLast) { 1132 multi_option_policy_ == CLI::MultiOptionPolicy::TakeLast) {
@@ -1136,7 +1136,7 @@ class Option : public OptionBase&lt;Option&gt; { @@ -1136,7 +1136,7 @@ class Option : public OptionBase&lt;Option&gt; {
1136 1136
1137 for(std::string &result : res) { 1137 for(std::string &result : res) {
1138 if(result.empty() && type_size_max_ != type_size_min_ && index >= 0) { 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 continue; 1140 continue;
1141 } 1141 }
1142 auto err_msg = _validate(result, (index >= 0) ? (index % type_size_max_) : index); 1142 auto err_msg = _validate(result, (index >= 0) ? (index % type_size_max_) : index);
@@ -1242,7 +1242,7 @@ class Option : public OptionBase&lt;Option&gt; { @@ -1242,7 +1242,7 @@ class Option : public OptionBase&lt;Option&gt; {
1242 int _add_result(std::string &&result, std::vector<std::string> &res) const { 1242 int _add_result(std::string &&result, std::vector<std::string> &res) const {
1243 int result_count = 0; 1243 int result_count = 0;
1244 if(allow_extra_args_ && !result.empty() && result.front() == '[' && 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 result.pop_back(); 1246 result.pop_back();
1247 1247
1248 for(auto &var : CLI::detail::split(result.substr(1), ',')) { 1248 for(auto &var : CLI::detail::split(result.substr(1), ',')) {
@@ -1270,6 +1270,6 @@ class Option : public OptionBase&lt;Option&gt; { @@ -1270,6 +1270,6 @@ class Option : public OptionBase&lt;Option&gt; {
1270 } 1270 }
1271 return result_count; 1271 return result_count;
1272 } 1272 }
1273 -}; // namespace CLI 1273 +}; // namespace CLI
1274 1274
1275 -} // namespace CLI 1275 +} // namespace CLI
include/CLI/Split.hpp
@@ -134,5 +134,5 @@ get_names(const std::vector&lt;std::string&gt; &amp;input) { @@ -134,5 +134,5 @@ get_names(const std::vector&lt;std::string&gt; &amp;input) {
134 short_names, long_names, pos_name); 134 short_names, long_names, pos_name);
135 } 135 }
136 136
137 -} // namespace detail  
138 -} // namespace CLI 137 +} // namespace detail
  138 +} // namespace CLI
include/CLI/StringTools.hpp
@@ -28,7 +28,7 @@ std::ostream &amp;operator&lt;&lt;(std::ostream &amp;in, const T &amp;item) { @@ -28,7 +28,7 @@ std::ostream &amp;operator&lt;&lt;(std::ostream &amp;in, const T &amp;item) {
28 return in << static_cast<typename std::underlying_type<T>::type>(item); 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 /// Export to CLI namespace 33 /// Export to CLI namespace
34 using enums::operator<<; 34 using enums::operator<<;
@@ -298,7 +298,7 @@ inline std::vector&lt;std::string&gt; split_up(std::string str, char delimiter = &#39;\0&#39;) @@ -298,7 +298,7 @@ inline std::vector&lt;std::string&gt; split_up(std::string str, char delimiter = &#39;\0&#39;)
298 if(delims.find_first_of(str[0]) != std::string::npos) { 298 if(delims.find_first_of(str[0]) != std::string::npos) {
299 keyChar = str[0]; 299 keyChar = str[0];
300 auto end = str.find_first_of(keyChar, 1); 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 end = str.find_first_of(keyChar, end + 1); 302 end = str.find_first_of(keyChar, end + 1);
303 embeddedQuote = true; 303 embeddedQuote = true;
304 } 304 }
@@ -356,7 +356,7 @@ inline std::size_t escape_detect(std::string &amp;str, std::size_t offset) { @@ -356,7 +356,7 @@ inline std::size_t escape_detect(std::string &amp;str, std::size_t offset) {
356 auto astart = str.find_last_of("-/ \"\'`", offset - 1); 356 auto astart = str.find_last_of("-/ \"\'`", offset - 1);
357 if(astart != std::string::npos) { 357 if(astart != std::string::npos) {
358 if(str[astart] == ((str[offset] == '=') ? '-' : '/')) 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 return offset + 1; 362 return offset + 1;
@@ -374,6 +374,6 @@ inline std::string &amp;add_quotes_if_needed(std::string &amp;str) { @@ -374,6 +374,6 @@ inline std::string &amp;add_quotes_if_needed(std::string &amp;str) {
374 return str; 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,7 +13,7 @@
13 #endif 13 #endif
14 14
15 #include <array> 15 #include <array>
16 -#include <chrono> // NOLINT(build/c++11) 16 +#include <chrono> // NOLINT(build/c++11)
17 #include <functional> 17 #include <functional>
18 #include <iostream> 18 #include <iostream>
19 #include <string> 19 #include <string>
@@ -128,7 +128,7 @@ class AutoTimer : public Timer { @@ -128,7 +128,7 @@ class AutoTimer : public Timer {
128 ~AutoTimer() { std::cout << to_string() << std::endl; } 128 ~AutoTimer() { std::cout << to_string() << std::endl; }
129 }; 129 };
130 130
131 -} // namespace CLI 131 +} // namespace CLI
132 132
133 /// This prints out the time if shifted into a std::cout like stream. 133 /// This prints out the time if shifted into a std::cout like stream.
134 inline std::ostream &operator<<(std::ostream &in, const CLI::Timer &timer) { return in << timer.to_string(); } 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,7 +27,7 @@ enum class enabler {};
27 27
28 /// An instance to use in EnableIf 28 /// An instance to use in EnableIf
29 constexpr enabler dummy = {}; 29 constexpr enabler dummy = {};
30 -} // namespace detail 30 +} // namespace detail
31 31
32 /// A copy of enable_if_t from C++14, compatible with C++11. 32 /// A copy of enable_if_t from C++14, compatible with C++11.
33 /// 33 ///
@@ -624,7 +624,7 @@ template &lt;typename T, @@ -624,7 +624,7 @@ template &lt;typename T,
624 enable_if_t<classify_object<T>::value == object_category::unsigned_integral, detail::enabler> = detail::dummy> 624 enable_if_t<classify_object<T>::value == object_category::unsigned_integral, detail::enabler> = detail::dummy>
625 bool lexical_cast(const std::string &input, T &output) { 625 bool lexical_cast(const std::string &input, T &output) {
626 if(!input.empty() && input.front() == '-') 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 try { 629 try {
630 std::size_t n = 0; 630 std::size_t n = 0;
@@ -804,7 +804,7 @@ bool lexical_assign(const std::string &amp;input, T &amp;output) { @@ -804,7 +804,7 @@ bool lexical_assign(const std::string &amp;input, T &amp;output) {
804 XC val{}; 804 XC val{};
805 bool parse_result = input.empty() ? true : lexical_cast<XC>(input, val); 805 bool parse_result = input.empty() ? true : lexical_cast<XC>(input, val);
806 if(parse_result) { 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 return parse_result; 809 return parse_result;
810 } 810 }
@@ -1007,5 +1007,5 @@ void sum_flag_vector(const std::vector&lt;std::string&gt; &amp;flags, T &amp;output) { @@ -1007,5 +1007,5 @@ void sum_flag_vector(const std::vector&lt;std::string&gt; &amp;flags, T &amp;output) {
1007 output = static_cast<T>(count); 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,7 +42,7 @@
42 #endif 42 #endif
43 43
44 #if defined CLI11_HAS_FILESYSTEM && CLI11_HAS_FILESYSTEM > 0 44 #if defined CLI11_HAS_FILESYSTEM && CLI11_HAS_FILESYSTEM > 0
45 -#include <filesystem> // NOLINT(build/include) 45 +#include <filesystem> // NOLINT(build/include)
46 #else 46 #else
47 #include <sys/stat.h> 47 #include <sys/stat.h>
48 #include <sys/types.h> 48 #include <sys/types.h>
@@ -270,7 +270,7 @@ class Validator { @@ -270,7 +270,7 @@ class Validator {
270 return std::string(1, '(') + f1 + ')' + merger + '(' + f2 + ')'; 270 return std::string(1, '(') + f1 + ')' + merger + '(' + f2 + ')';
271 }; 271 };
272 } 272 }
273 -}; // namespace CLI 273 +}; // namespace CLI
274 274
275 /// Class wrapping some of the accessors of Validator 275 /// Class wrapping some of the accessors of Validator
276 class CustomValidator : public Validator { 276 class CustomValidator : public Validator {
@@ -459,7 +459,7 @@ class Number : 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 // Static is not needed here, because global const implies static. 464 // Static is not needed here, because global const implies static.
465 465
@@ -561,7 +561,7 @@ typename std::remove_reference&lt;T&gt;::type &amp;smart_deref(T &amp;value) { @@ -561,7 +561,7 @@ typename std::remove_reference&lt;T&gt;::type &amp;smart_deref(T &amp;value) {
561 /// Generate a string representation of a set 561 /// Generate a string representation of a set
562 template <typename T> std::string generate_set(const T &set) { 562 template <typename T> std::string generate_set(const T &set) {
563 using element_t = typename detail::element_type<T>::type; 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 std::string out(1, '{'); 565 std::string out(1, '{');
566 out.append(detail::join( 566 out.append(detail::join(
567 detail::smart_deref(set), 567 detail::smart_deref(set),
@@ -574,7 +574,7 @@ template &lt;typename T&gt; std::string generate_set(const T &amp;set) { @@ -574,7 +574,7 @@ template &lt;typename T&gt; std::string generate_set(const T &amp;set) {
574 /// Generate a string representation of a map 574 /// Generate a string representation of a map
575 template <typename T> std::string generate_map(const T &map, bool key_only = false) { 575 template <typename T> std::string generate_map(const T &map, bool key_only = false) {
576 using element_t = typename detail::element_type<T>::type; 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 std::string out(1, '{'); 578 std::string out(1, '{');
579 out.append(detail::join( 579 out.append(detail::join(
580 detail::smart_deref(map), 580 detail::smart_deref(map),
@@ -685,7 +685,7 @@ typename std::enable_if&lt;std::is_floating_point&lt;T&gt;::value, bool&gt;::type checked_mu @@ -685,7 +685,7 @@ typename std::enable_if&lt;std::is_floating_point&lt;T&gt;::value, bool&gt;::type checked_mu
685 return true; 685 return true;
686 } 686 }
687 687
688 -} // namespace detail 688 +} // namespace detail
689 /// Verify items are in a set 689 /// Verify items are in a set
690 class IsMember : public Validator { 690 class IsMember : public Validator {
691 public: 691 public:
@@ -705,11 +705,11 @@ class IsMember : public Validator { @@ -705,11 +705,11 @@ class IsMember : public Validator {
705 705
706 // Get the type of the contained item - requires a container have ::value_type 706 // Get the type of the contained item - requires a container have ::value_type
707 // if the type does not have first_type and second_type, these are both value_type 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 // Make a local copy of the filter function, using a std::function if not one already 714 // Make a local copy of the filter function, using a std::function if not one already
715 std::function<local_item_t(local_item_t)> filter_fn = filter_function; 715 std::function<local_item_t(local_item_t)> filter_fn = filter_function;
@@ -722,7 +722,7 @@ class IsMember : public Validator { @@ -722,7 +722,7 @@ class IsMember : public Validator {
722 func_ = [set, filter_fn](std::string &input) { 722 func_ = [set, filter_fn](std::string &input) {
723 local_item_t b; 723 local_item_t b;
724 if(!detail::lexical_cast(input, b)) { 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 if(filter_fn) { 727 if(filter_fn) {
728 b = filter_fn(b); 728 b = filter_fn(b);
@@ -778,10 +778,10 @@ class Transformer : public Validator { @@ -778,10 +778,10 @@ class Transformer : public Validator {
778 "mapping must produce value pairs"); 778 "mapping must produce value pairs");
779 // Get the type of the contained item - requires a container have ::value_type 779 // Get the type of the contained item - requires a container have ::value_type
780 // if the type does not have first_type and second_type, these are both value_type 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 // Make a local copy of the filter function, using a std::function if not one already 786 // Make a local copy of the filter function, using a std::function if not one already
787 std::function<local_item_t(local_item_t)> filter_fn = filter_function; 787 std::function<local_item_t(local_item_t)> filter_fn = filter_function;
@@ -836,12 +836,11 @@ class CheckedTransformer : public Validator { @@ -836,12 +836,11 @@ class CheckedTransformer : public Validator {
836 "mapping must produce value pairs"); 836 "mapping must produce value pairs");
837 // Get the type of the contained item - requires a container have ::value_type 837 // Get the type of the contained item - requires a container have ::value_type
838 // if the type does not have first_type and second_type, these are both value_type 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 // Make a local copy of the filter function, using a std::function if not one already 845 // Make a local copy of the filter function, using a std::function if not one already
847 std::function<local_item_t(local_item_t)> filter_fn = filter_function; 846 std::function<local_item_t(local_item_t)> filter_fn = filter_function;
@@ -1125,7 +1124,7 @@ inline std::pair&lt;std::string, std::string&gt; split_program_name(std::string comman @@ -1125,7 +1124,7 @@ inline std::pair&lt;std::string, std::string&gt; split_program_name(std::string comman
1125 return vals; 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,7 +684,7 @@ TEST_F(TApp, FlagLikeOption) {
684 EXPECT_EQ(1u, app.count("--flag")); 684 EXPECT_EQ(1u, app.count("--flag"));
685 EXPECT_TRUE(val); 685 EXPECT_TRUE(val);
686 val = false; 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 EXPECT_EQ(opt->get_type_size_min(), 0); 688 EXPECT_EQ(opt->get_type_size_min(), 0);
689 EXPECT_EQ(opt->get_type_size_max(), 0); 689 EXPECT_EQ(opt->get_type_size_max(), 0);
690 run(); 690 run();
@@ -797,7 +797,7 @@ TEST_F(TApp, DefaultOpts) { @@ -797,7 +797,7 @@ TEST_F(TApp, DefaultOpts) {
797 std::string s = "HI"; 797 std::string s = "HI";
798 798
799 app.add_option("-i,i", i); 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 args = {"-i2", "9"}; 802 args = {"-i2", "9"};
803 803
@@ -1191,7 +1191,7 @@ TEST_F(TApp, RequiredPositionalVector) { @@ -1191,7 +1191,7 @@ TEST_F(TApp, RequiredPositionalVector) {
1191 // Tests positionals at end 1191 // Tests positionals at end
1192 TEST_F(TApp, RequiredPositionalValidation) { 1192 TEST_F(TApp, RequiredPositionalValidation) {
1193 std::vector<std::string> sources; 1193 std::vector<std::string> sources;
1194 - int dest; // required 1194 + int dest; // required
1195 std::string d2; 1195 std::string d2;
1196 app.add_option("src", sources); 1196 app.add_option("src", sources);
1197 app.add_option("dest", dest)->required()->check(CLI::PositiveNumber); 1197 app.add_option("dest", dest)->required()->check(CLI::PositiveNumber);
@@ -1416,7 +1416,7 @@ TEST_F(TApp, NotRequiredExpectedDoubleShort) { @@ -1416,7 +1416,7 @@ TEST_F(TApp, NotRequiredExpectedDoubleShort) {
1416 1416
1417 TEST_F(TApp, RequiredFlags) { 1417 TEST_F(TApp, RequiredFlags) {
1418 app.add_flag("-a")->required(); 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 EXPECT_THROW(run(), CLI::RequiredError); 1421 EXPECT_THROW(run(), CLI::RequiredError);
1422 1422
@@ -1686,7 +1686,7 @@ TEST_F(TApp, RemoveExcludesLinks) { @@ -1686,7 +1686,7 @@ TEST_F(TApp, RemoveExcludesLinks) {
1686 1686
1687 args = {"--two"}; 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 TEST_F(TApp, FileNotExists) { 1692 TEST_F(TApp, FileNotExists) {
@@ -1700,7 +1700,7 @@ TEST_F(TApp, FileNotExists) { @@ -1700,7 +1700,7 @@ TEST_F(TApp, FileNotExists) {
1700 run(); 1700 run();
1701 EXPECT_EQ(myfile, filename); 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 EXPECT_TRUE(ok); 1704 EXPECT_TRUE(ok);
1705 EXPECT_THROW(run(), CLI::ValidationError); 1705 EXPECT_THROW(run(), CLI::ValidationError);
1706 // deactivate the check, so it should run now 1706 // deactivate the check, so it should run now
@@ -1720,7 +1720,7 @@ TEST_F(TApp, FileExists) { @@ -1720,7 +1720,7 @@ TEST_F(TApp, FileExists) {
1720 1720
1721 EXPECT_THROW(run(), CLI::ValidationError); 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 EXPECT_TRUE(ok); 1724 EXPECT_TRUE(ok);
1725 run(); 1725 run();
1726 EXPECT_EQ(myfile, filename); 1726 EXPECT_EQ(myfile, filename);
@@ -1739,7 +1739,7 @@ TEST_F(TApp, NotFileExists) { @@ -1739,7 +1739,7 @@ TEST_F(TApp, NotFileExists) {
1739 1739
1740 EXPECT_NO_THROW(run()); 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 EXPECT_TRUE(ok); 1743 EXPECT_TRUE(ok);
1744 EXPECT_THROW(run(), CLI::ValidationError); 1744 EXPECT_THROW(run(), CLI::ValidationError);
1745 1745
@@ -1749,7 +1749,7 @@ TEST_F(TApp, NotFileExists) { @@ -1749,7 +1749,7 @@ TEST_F(TApp, NotFileExists) {
1749 1749
1750 TEST_F(TApp, pair_check) { 1750 TEST_F(TApp, pair_check) {
1751 std::string myfile{"pair_check_file.txt"}; 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 EXPECT_TRUE(ok); 1753 EXPECT_TRUE(ok);
1754 1754
1755 EXPECT_TRUE(CLI::ExistingFile(myfile).empty()); 1755 EXPECT_TRUE(CLI::ExistingFile(myfile).empty());
@@ -1781,7 +1781,7 @@ TEST_F(TApp, pair_check) { @@ -1781,7 +1781,7 @@ TEST_F(TApp, pair_check) {
1781 1781
1782 TEST_F(TApp, pair_check_take_first) { 1782 TEST_F(TApp, pair_check_take_first) {
1783 std::string myfile{"pair_check_file2.txt"}; 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 EXPECT_TRUE(ok); 1785 EXPECT_TRUE(ok);
1786 1786
1787 EXPECT_TRUE(CLI::ExistingFile(myfile).empty()); 1787 EXPECT_TRUE(CLI::ExistingFile(myfile).empty());
@@ -1924,7 +1924,7 @@ TEST_F(TApp, VectorExpectedRange) { @@ -1924,7 +1924,7 @@ TEST_F(TApp, VectorExpectedRange) {
1924 1924
1925 EXPECT_EQ(opt->get_expected_max(), 4); 1925 EXPECT_EQ(opt->get_expected_max(), 4);
1926 EXPECT_EQ(opt->get_expected_min(), 2); 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 EXPECT_EQ(opt->get_expected_max(), 4); 1928 EXPECT_EQ(opt->get_expected_max(), 4);
1929 EXPECT_EQ(opt->get_expected_min(), 2); 1929 EXPECT_EQ(opt->get_expected_min(), 2);
1930 opt->expected(-5); 1930 opt->expected(-5);
@@ -2459,7 +2459,7 @@ TEST_F(TApp, vectorPairTypeRange) { @@ -2459,7 +2459,7 @@ TEST_F(TApp, vectorPairTypeRange) {
2459 2459
2460 auto opt = app.add_option("--dict", custom_opt); 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 EXPECT_EQ(opt->get_type_size_min(), 1); 2463 EXPECT_EQ(opt->get_type_size_min(), 1);
2464 EXPECT_EQ(opt->get_type_size_max(), 2); 2464 EXPECT_EQ(opt->get_type_size_max(), 2);
2465 2465
@@ -2477,7 +2477,7 @@ TEST_F(TApp, vectorPairTypeRange) { @@ -2477,7 +2477,7 @@ TEST_F(TApp, vectorPairTypeRange) {
2477 EXPECT_EQ(custom_opt[2].first, -1); 2477 EXPECT_EQ(custom_opt[2].first, -1);
2478 EXPECT_EQ(custom_opt[2].second, "str4"); 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 EXPECT_EQ(opt->get_type_size_min(), 1); 2481 EXPECT_EQ(opt->get_type_size_min(), 1);
2482 EXPECT_EQ(opt->get_type_size_max(), 2); 2482 EXPECT_EQ(opt->get_type_size_max(), 2);
2483 // this type size spec should run exactly as before 2483 // this type size spec should run exactly as before
tests/ConfigFileTest.cpp
@@ -1045,7 +1045,7 @@ TEST_F(TApp, IniSubcommandMultipleSections) { @@ -1045,7 +1045,7 @@ TEST_F(TApp, IniSubcommandMultipleSections) {
1045 EXPECT_EQ(parse_c[0], 68U); 1045 EXPECT_EQ(parse_c[0], 68U);
1046 EXPECT_EQ(parse_c[1], 58U); 1046 EXPECT_EQ(parse_c[1], 58U);
1047 EXPECT_EQ(subsubcom->count(), 1u); 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 TEST_F(TApp, DuplicateSubcommandCallbacks) { 1051 TEST_F(TApp, DuplicateSubcommandCallbacks) {
@@ -1718,7 +1718,7 @@ TEST_F(TApp, StopReadingConfigOnClear) { @@ -1718,7 +1718,7 @@ TEST_F(TApp, StopReadingConfigOnClear) {
1718 TempFile tmpini{"TestIniTmp.ini"}; 1718 TempFile tmpini{"TestIniTmp.ini"};
1719 1719
1720 app.set_config("--config", tmpini); 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 EXPECT_EQ(ptr, nullptr); 1722 EXPECT_EQ(ptr, nullptr);
1723 1723
1724 { 1724 {
tests/CreationTest.cpp
@@ -527,7 +527,7 @@ TEST_F(TApp, GetOptionList) { @@ -527,7 +527,7 @@ TEST_F(TApp, GetOptionList) {
527 auto flag = app.add_flag("--one"); 527 auto flag = app.add_flag("--one");
528 auto opt = app.add_option("--two", two); 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 std::vector<const CLI::Option *> opt_list = const_app.get_options(); 531 std::vector<const CLI::Option *> opt_list = const_app.get_options();
532 532
533 ASSERT_EQ(opt_list.size(), static_cast<std::size_t>(3)); 533 ASSERT_EQ(opt_list.size(), static_cast<std::size_t>(3));
tests/HelpTest.cpp
@@ -715,7 +715,7 @@ TEST(Exit, ExitCodes) { @@ -715,7 +715,7 @@ TEST(Exit, ExitCodes) {
715 EXPECT_EQ(0, app.exit(CLI::CallForHelp())); 715 EXPECT_EQ(0, app.exit(CLI::CallForHelp()));
716 EXPECT_EQ(i, app.exit(CLI::ExtrasError({"Thing"}))); 716 EXPECT_EQ(i, app.exit(CLI::ExtrasError({"Thing"})));
717 EXPECT_EQ(42, app.exit(CLI::RuntimeError(42))); 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 struct CapturedHelp : public ::testing::Test { 721 struct CapturedHelp : public ::testing::Test {
@@ -945,7 +945,7 @@ TEST(THelp, ValidatorsText) { @@ -945,7 +945,7 @@ TEST(THelp, ValidatorsText) {
945 std::string help = app.help(); 945 std::string help = app.help();
946 EXPECT_THAT(help, HasSubstr("TEXT:FILE")); 946 EXPECT_THAT(help, HasSubstr("TEXT:FILE"));
947 EXPECT_THAT(help, HasSubstr("INT in [1 - 4]")); 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 TEST(THelp, ValidatorsTextCustom) { 951 TEST(THelp, ValidatorsTextCustom) {
tests/HelpersTest.cpp
@@ -218,7 +218,7 @@ TEST(Trim, TrimCopy) { @@ -218,7 +218,7 @@ TEST(Trim, TrimCopy) {
218 TEST(Validators, FileExists) { 218 TEST(Validators, FileExists) {
219 std::string myfile{"TestFileNotUsed.txt"}; 219 std::string myfile{"TestFileNotUsed.txt"};
220 EXPECT_FALSE(CLI::ExistingFile(myfile).empty()); 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 EXPECT_TRUE(ok); 222 EXPECT_TRUE(ok);
223 EXPECT_TRUE(CLI::ExistingFile(myfile).empty()); 223 EXPECT_TRUE(CLI::ExistingFile(myfile).empty());
224 224
@@ -229,7 +229,7 @@ TEST(Validators, FileExists) { @@ -229,7 +229,7 @@ TEST(Validators, FileExists) {
229 TEST(Validators, FileNotExists) { 229 TEST(Validators, FileNotExists) {
230 std::string myfile{"TestFileNotUsed.txt"}; 230 std::string myfile{"TestFileNotUsed.txt"};
231 EXPECT_TRUE(CLI::NonexistentPath(myfile).empty()); 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 EXPECT_TRUE(ok); 233 EXPECT_TRUE(ok);
234 EXPECT_FALSE(CLI::NonexistentPath(myfile).empty()); 234 EXPECT_FALSE(CLI::NonexistentPath(myfile).empty());
235 235
@@ -255,7 +255,7 @@ TEST(Validators, DirectoryNotExists) { @@ -255,7 +255,7 @@ TEST(Validators, DirectoryNotExists) {
255 TEST(Validators, DirectoryIsFile) { 255 TEST(Validators, DirectoryIsFile) {
256 std::string myfile{"TestFileNotUsed.txt"}; 256 std::string myfile{"TestFileNotUsed.txt"};
257 EXPECT_TRUE(CLI::NonexistentPath(myfile).empty()); 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 EXPECT_TRUE(ok); 259 EXPECT_TRUE(ok);
260 EXPECT_FALSE(CLI::ExistingDirectory(myfile).empty()); 260 EXPECT_FALSE(CLI::ExistingDirectory(myfile).empty());
261 261
@@ -271,7 +271,7 @@ TEST(Validators, PathExistsDir) { @@ -271,7 +271,7 @@ TEST(Validators, PathExistsDir) {
271 TEST(Validators, PathExistsFile) { 271 TEST(Validators, PathExistsFile) {
272 std::string myfile{"TestFileNotUsed.txt"}; 272 std::string myfile{"TestFileNotUsed.txt"};
273 EXPECT_FALSE(CLI::ExistingPath(myfile).empty()); 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 EXPECT_TRUE(ok); 275 EXPECT_TRUE(ok);
276 EXPECT_TRUE(CLI::ExistingPath(myfile).empty()); 276 EXPECT_TRUE(CLI::ExistingPath(myfile).empty());
277 277
@@ -383,7 +383,7 @@ TEST(Validators, CombinedOrRange) { @@ -383,7 +383,7 @@ TEST(Validators, CombinedOrRange) {
383 TEST(Validators, CombinedPaths) { 383 TEST(Validators, CombinedPaths) {
384 std::string myfile{"TestFileNotUsed.txt"}; 384 std::string myfile{"TestFileNotUsed.txt"};
385 EXPECT_FALSE(CLI::ExistingFile(myfile).empty()); 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 EXPECT_TRUE(ok); 387 EXPECT_TRUE(ok);
388 388
389 std::string dir{"../tests"}; 389 std::string dir{"../tests"};
@@ -435,7 +435,7 @@ TEST(Validators, ProgramNameSplit) { @@ -435,7 +435,7 @@ TEST(Validators, ProgramNameSplit) {
435 EXPECT_EQ(res.second, "this is a bunch of extra stuff"); 435 EXPECT_EQ(res.second, "this is a bunch of extra stuff");
436 436
437 res = CLI::detail::split_program_name("./program_name this is a bunch of extra stuff "); 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 EXPECT_EQ(res.second, "this is a bunch of extra stuff"); 439 EXPECT_EQ(res.second, "this is a bunch of extra stuff");
440 440
441 res = CLI::detail::split_program_name(std::string(" ./") + std::string(myfile) + " "); 441 res = CLI::detail::split_program_name(std::string(" ./") + std::string(myfile) + " ");
@@ -663,7 +663,7 @@ TEST(AppHelper, TempfileCreated) { @@ -663,7 +663,7 @@ TEST(AppHelper, TempfileCreated) {
663 663
664 EXPECT_FALSE(CLI::ExistingFile(myfile).empty()); 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 EXPECT_TRUE(ok); 667 EXPECT_TRUE(ok);
668 EXPECT_TRUE(CLI::ExistingFile(name).empty()); 668 EXPECT_TRUE(CLI::ExistingFile(name).empty());
669 EXPECT_THROW({ TempFile otherfile(name); }, std::runtime_error); 669 EXPECT_THROW({ TempFile otherfile(name); }, std::runtime_error);
@@ -994,12 +994,12 @@ TEST(Types, LexicalCastParsable) { @@ -994,12 +994,12 @@ TEST(Types, LexicalCastParsable) {
994 994
995 std::complex<double> output; 995 std::complex<double> output;
996 EXPECT_TRUE(CLI::detail::lexical_cast(input, output)); 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 EXPECT_TRUE(CLI::detail::lexical_cast("2.456", output)); 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 EXPECT_FALSE(CLI::detail::lexical_cast(fail_input, output)); 1004 EXPECT_FALSE(CLI::detail::lexical_cast(fail_input, output));
1005 EXPECT_FALSE(CLI::detail::lexical_cast(extra_input, output)); 1005 EXPECT_FALSE(CLI::detail::lexical_cast(extra_input, output));
tests/NewParseTest.cpp
@@ -222,8 +222,8 @@ template &lt;&gt; bool lexical_cast&lt;spair&gt;(const std::string &amp;input, spair &amp;output) { @@ -222,8 +222,8 @@ template &lt;&gt; bool lexical_cast&lt;spair&gt;(const std::string &amp;input, spair &amp;output) {
222 output = {input.substr(0, sep), input.substr(sep + 1)}; 222 output = {input.substr(0, sep), input.substr(sep + 1)};
223 return true; 223 return true;
224 } 224 }
225 -} // namespace detail  
226 -} // namespace CLI 225 +} // namespace detail
  226 +} // namespace CLI
227 227
228 TEST_F(TApp, custom_string_converter) { 228 TEST_F(TApp, custom_string_converter) {
229 spair val; 229 spair val;
@@ -295,14 +295,14 @@ template &lt;&gt; bool lexical_cast&lt;std::complex&lt;double&gt;&gt;(const std::string &amp;input, st @@ -295,14 +295,14 @@ template &lt;&gt; bool lexical_cast&lt;std::complex&lt;double&gt;&gt;(const std::string &amp;input, st
295 } 295 }
296 return worked; 296 return worked;
297 } 297 }
298 -} // namespace detail  
299 -} // namespace CLI 298 +} // namespace detail
  299 +} // namespace CLI
300 300
301 TEST_F(TApp, AddingComplexParserDetail) { 301 TEST_F(TApp, AddingComplexParserDetail) {
302 302
303 bool skip_tests = false; 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 std::smatch m; 306 std::smatch m;
307 std::string input = "1.5+2.5j"; 307 std::string input = "1.5+2.5j";
308 static const std::regex creg( 308 static const std::regex creg(
tests/OptionGroupTest.cpp
@@ -768,6 +768,6 @@ TEST_F(ManyGroupsPreTrigger, PreTriggerTestsSubcommand) { @@ -768,6 +768,6 @@ TEST_F(ManyGroupsPreTrigger, PreTriggerTestsSubcommand) {
768 EXPECT_EQ(triggerMain, 4u); 768 EXPECT_EQ(triggerMain, 4u);
769 EXPECT_EQ(trigger1, 1u); 769 EXPECT_EQ(trigger1, 1u);
770 EXPECT_EQ(trigger2, 3u); 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,11 +508,11 @@ TEST_F(TApp, InSetIgnoreCase) {
508 508
509 args = {"--quick", "two"}; 509 args = {"--quick", "two"};
510 run(); 510 run();
511 - EXPECT_EQ("Two", choice); // Keeps caps from set 511 + EXPECT_EQ("Two", choice); // Keeps caps from set
512 512
513 args = {"--quick", "ThrEE"}; 513 args = {"--quick", "ThrEE"};
514 run(); 514 run();
515 - EXPECT_EQ("THREE", choice); // Keeps caps from set 515 + EXPECT_EQ("THREE", choice); // Keeps caps from set
516 516
517 args = {"--quick", "four"}; 517 args = {"--quick", "four"};
518 EXPECT_THROW(run(), CLI::ValidationError); 518 EXPECT_THROW(run(), CLI::ValidationError);
@@ -533,11 +533,11 @@ TEST_F(TApp, InSetIgnoreCaseMutableValue) { @@ -533,11 +533,11 @@ TEST_F(TApp, InSetIgnoreCaseMutableValue) {
533 533
534 args = {"--quick", "two"}; 534 args = {"--quick", "two"};
535 run(); 535 run();
536 - EXPECT_EQ("Two", choice); // Keeps caps from set 536 + EXPECT_EQ("Two", choice); // Keeps caps from set
537 537
538 args = {"--quick", "ThrEE"}; 538 args = {"--quick", "ThrEE"};
539 run(); 539 run();
540 - EXPECT_EQ("THREE", choice); // Keeps caps from set 540 + EXPECT_EQ("THREE", choice); // Keeps caps from set
541 541
542 options.clear(); 542 options.clear();
543 args = {"--quick", "ThrEE"}; 543 args = {"--quick", "ThrEE"};
@@ -556,16 +556,16 @@ TEST_F(TApp, InSetIgnoreCasePointer) { @@ -556,16 +556,16 @@ TEST_F(TApp, InSetIgnoreCasePointer) {
556 556
557 args = {"--quick", "two"}; 557 args = {"--quick", "two"};
558 run(); 558 run();
559 - EXPECT_EQ("Two", choice); // Keeps caps from set 559 + EXPECT_EQ("Two", choice); // Keeps caps from set
560 560
561 args = {"--quick", "ThrEE"}; 561 args = {"--quick", "ThrEE"};
562 run(); 562 run();
563 - EXPECT_EQ("THREE", choice); // Keeps caps from set 563 + EXPECT_EQ("THREE", choice); // Keeps caps from set
564 564
565 delete options; 565 delete options;
566 args = {"--quick", "ThrEE"}; 566 args = {"--quick", "ThrEE"};
567 run(); 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 args = {"--quick", "four"}; 570 args = {"--quick", "four"};
571 EXPECT_THROW(run(), CLI::ValidationError); 571 EXPECT_THROW(run(), CLI::ValidationError);
@@ -600,11 +600,11 @@ TEST_F(TApp, InSetIgnoreUnderscore) { @@ -600,11 +600,11 @@ TEST_F(TApp, InSetIgnoreUnderscore) {
600 600
601 args = {"--quick", "optiontwo"}; 601 args = {"--quick", "optiontwo"};
602 run(); 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 args = {"--quick", "_option_thr_ee"}; 605 args = {"--quick", "_option_thr_ee"};
606 run(); 606 run();
607 - EXPECT_EQ("optionthree", choice); // no underscore 607 + EXPECT_EQ("optionthree", choice); // no underscore
608 608
609 args = {"--quick", "Option4"}; 609 args = {"--quick", "Option4"};
610 EXPECT_THROW(run(), CLI::ValidationError); 610 EXPECT_THROW(run(), CLI::ValidationError);
@@ -626,11 +626,11 @@ TEST_F(TApp, InSetIgnoreCaseUnderscore) { @@ -626,11 +626,11 @@ TEST_F(TApp, InSetIgnoreCaseUnderscore) {
626 626
627 args = {"--quick", "OptionTwo"}; 627 args = {"--quick", "OptionTwo"};
628 run(); 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 args = {"--quick", "_OPTION_thr_ee"}; 631 args = {"--quick", "_OPTION_thr_ee"};
632 run(); 632 run();
633 - EXPECT_EQ("OptionThree", choice); // no underscore 633 + EXPECT_EQ("OptionThree", choice); // no underscore
634 634
635 args = {"--quick", "Option4"}; 635 args = {"--quick", "Option4"};
636 EXPECT_THROW(run(), CLI::ValidationError); 636 EXPECT_THROW(run(), CLI::ValidationError);
tests/SubcommandTest.cpp
@@ -104,7 +104,7 @@ TEST_F(TApp, CrazyNameSubcommand) { @@ -104,7 +104,7 @@ TEST_F(TApp, CrazyNameSubcommand) {
104 EXPECT_EQ(sub1->count(), 1u); 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 std::string baz; 109 std::string baz;
110 app.add_option("baz", baz, "Baz Description", true)->required(); 110 app.add_option("baz", baz, "Baz Description", true)->required();
@@ -631,13 +631,13 @@ TEST_F(TApp, CallbackOrderingImmediateMain) { @@ -631,13 +631,13 @@ TEST_F(TApp, CallbackOrderingImmediateMain) {
631 EXPECT_EQ(0, sub_val); 631 EXPECT_EQ(0, sub_val);
632 // the main app callback should run before the subcommand callbacks 632 // the main app callback should run before the subcommand callbacks
633 app.immediate_callback(); 633 app.immediate_callback();
634 - val = 0; // reset value 634 + val = 0; // reset value
635 run(); 635 run();
636 EXPECT_EQ(2, val); 636 EXPECT_EQ(2, val);
637 EXPECT_EQ(1, sub_val); 637 EXPECT_EQ(1, sub_val);
638 // the subcommand callback now runs immediately after processing and before the main app callback again 638 // the subcommand callback now runs immediately after processing and before the main app callback again
639 sub->immediate_callback(); 639 sub->immediate_callback();
640 - val = 0; // reset value 640 + val = 0; // reset value
641 run(); 641 run();
642 EXPECT_EQ(1, val); 642 EXPECT_EQ(1, val);
643 EXPECT_EQ(0, sub_val); 643 EXPECT_EQ(0, sub_val);
@@ -1213,7 +1213,7 @@ TEST_F(ManySubcommands, Unlimited) { @@ -1213,7 +1213,7 @@ TEST_F(ManySubcommands, Unlimited) {
1213 run(); 1213 run();
1214 EXPECT_EQ(app.remaining(true), vs_t()); 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 run(); 1218 run();
1219 EXPECT_EQ(app.remaining(true), vs_t()); 1219 EXPECT_EQ(app.remaining(true), vs_t());
tests/TrueFalseTest.cpp
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 struct TApp_TBO : public TApp, public ::testing::WithParamInterface<const char *> {}; 4 struct TApp_TBO : public TApp, public ::testing::WithParamInterface<const char *> {};
5 5
6 TEST_P(TApp_TBO, TrueBoolOption) { 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 app.add_option("-b,--bool", value); 8 app.add_option("-b,--bool", value);
9 args = {"--bool", GetParam()}; 9 args = {"--bool", GetParam()};
10 run(); 10 run();
@@ -19,7 +19,7 @@ INSTANTIATE_TEST_CASE_P(TrueBoolOptions, TApp_TBO, ::testing::Values(&quot;true&quot;, &quot;on @@ -19,7 +19,7 @@ INSTANTIATE_TEST_CASE_P(TrueBoolOptions, TApp_TBO, ::testing::Values(&quot;true&quot;, &quot;on
19 struct TApp_FBO : public TApp, public ::testing::WithParamInterface<const char *> {}; 19 struct TApp_FBO : public TApp, public ::testing::WithParamInterface<const char *> {};
20 20
21 TEST_P(TApp_FBO, FalseBoolOptions) { 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 app.add_option("-b,--bool", value); 23 app.add_option("-b,--bool", value);
24 args = {"--bool", GetParam()}; 24 args = {"--bool", GetParam()};
25 run(); 25 run();
tests/app_helper.hpp
@@ -33,7 +33,7 @@ class TempFile { @@ -33,7 +33,7 @@ class TempFile {
33 } 33 }
34 34
35 ~TempFile() { 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 operator const std::string &() const { return _name; } 39 operator const std::string &() const { return _name; }