Commit 3eb5e1eedd3504465ff72773e300d0440a215493
Committed by
GitHub
1 parent
fa423c45
fix: rename enum class parameter 'WINDOWS' in detail::Classifier to 'WINDOWS_STY…
…LE' to remove conflicts with cmake default definitions (#563)
Showing
2 changed files
with
6 additions
and
6 deletions
include/CLI/App.hpp
| @@ -44,7 +44,7 @@ namespace CLI { | @@ -44,7 +44,7 @@ namespace CLI { | ||
| 44 | #endif | 44 | #endif |
| 45 | 45 | ||
| 46 | namespace detail { | 46 | namespace detail { |
| 47 | -enum class Classifier { NONE, POSITIONAL_MARK, SHORT, LONG, WINDOWS, SUBCOMMAND, SUBCOMMAND_TERMINATOR }; | 47 | +enum class Classifier { NONE, POSITIONAL_MARK, SHORT, LONG, WINDOWS_STYLE, SUBCOMMAND, SUBCOMMAND_TERMINATOR }; |
| 48 | struct AppFriend; | 48 | struct AppFriend; |
| 49 | } // namespace detail | 49 | } // namespace detail |
| 50 | 50 | ||
| @@ -2072,7 +2072,7 @@ class App { | @@ -2072,7 +2072,7 @@ class App { | ||
| 2072 | return detail::Classifier::SHORT; | 2072 | return detail::Classifier::SHORT; |
| 2073 | } | 2073 | } |
| 2074 | if((allow_windows_style_options_) && (detail::split_windows_style(current, dummy1, dummy2))) | 2074 | if((allow_windows_style_options_) && (detail::split_windows_style(current, dummy1, dummy2))) |
| 2075 | - return detail::Classifier::WINDOWS; | 2075 | + return detail::Classifier::WINDOWS_STYLE; |
| 2076 | if((current == "++") && !name_.empty() && parent_ != nullptr) | 2076 | if((current == "++") && !name_.empty() && parent_ != nullptr) |
| 2077 | return detail::Classifier::SUBCOMMAND_TERMINATOR; | 2077 | return detail::Classifier::SUBCOMMAND_TERMINATOR; |
| 2078 | return detail::Classifier::NONE; | 2078 | return detail::Classifier::NONE; |
| @@ -2525,7 +2525,7 @@ class App { | @@ -2525,7 +2525,7 @@ class App { | ||
| 2525 | break; | 2525 | break; |
| 2526 | case detail::Classifier::LONG: | 2526 | case detail::Classifier::LONG: |
| 2527 | case detail::Classifier::SHORT: | 2527 | case detail::Classifier::SHORT: |
| 2528 | - case detail::Classifier::WINDOWS: | 2528 | + case detail::Classifier::WINDOWS_STYLE: |
| 2529 | // If already parsed a subcommand, don't accept options_ | 2529 | // If already parsed a subcommand, don't accept options_ |
| 2530 | _parse_arg(args, classifier); | 2530 | _parse_arg(args, classifier); |
| 2531 | break; | 2531 | break; |
| @@ -2742,7 +2742,7 @@ class App { | @@ -2742,7 +2742,7 @@ class App { | ||
| 2742 | if(!detail::split_short(current, arg_name, rest)) | 2742 | if(!detail::split_short(current, arg_name, rest)) |
| 2743 | throw HorribleError("Short parsed but missing! You should not see this"); | 2743 | throw HorribleError("Short parsed but missing! You should not see this"); |
| 2744 | break; | 2744 | break; |
| 2745 | - case detail::Classifier::WINDOWS: | 2745 | + case detail::Classifier::WINDOWS_STYLE: |
| 2746 | if(!detail::split_windows_style(current, arg_name, value)) | 2746 | if(!detail::split_windows_style(current, arg_name, value)) |
| 2747 | throw HorribleError("windows option parsed but missing! You should not see this"); | 2747 | throw HorribleError("windows option parsed but missing! You should not see this"); |
| 2748 | break; | 2748 | break; |
| @@ -2760,7 +2760,7 @@ class App { | @@ -2760,7 +2760,7 @@ class App { | ||
| 2760 | return opt->check_lname(arg_name); | 2760 | return opt->check_lname(arg_name); |
| 2761 | if(current_type == detail::Classifier::SHORT) | 2761 | if(current_type == detail::Classifier::SHORT) |
| 2762 | return opt->check_sname(arg_name); | 2762 | return opt->check_sname(arg_name); |
| 2763 | - // this will only get called for detail::Classifier::WINDOWS | 2763 | + // this will only get called for detail::Classifier::WINDOWS_STYLE |
| 2764 | return opt->check_lname(arg_name) || opt->check_sname(arg_name); | 2764 | return opt->check_lname(arg_name) || opt->check_sname(arg_name); |
| 2765 | }); | 2765 | }); |
| 2766 | 2766 |
tests/AppTest.cpp
| @@ -1964,7 +1964,7 @@ TEST_CASE_METHOD(TApp, "CheckLongFail", "[app]") { | @@ -1964,7 +1964,7 @@ TEST_CASE_METHOD(TApp, "CheckLongFail", "[app]") { | ||
| 1964 | TEST_CASE_METHOD(TApp, "CheckWindowsFail", "[app]") { | 1964 | TEST_CASE_METHOD(TApp, "CheckWindowsFail", "[app]") { |
| 1965 | args = {"-t"}; | 1965 | args = {"-t"}; |
| 1966 | 1966 | ||
| 1967 | - CHECK_THROWS_AS(CLI::detail::AppFriend::parse_arg(&app, args, CLI::detail::Classifier::WINDOWS), | 1967 | + CHECK_THROWS_AS(CLI::detail::AppFriend::parse_arg(&app, args, CLI::detail::Classifier::WINDOWS_STYLE), |
| 1968 | CLI::HorribleError); | 1968 | CLI::HorribleError); |
| 1969 | } | 1969 | } |
| 1970 | 1970 |