Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trigger on parse positional #713

Merged
merged 2 commits into from
Mar 21, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
style: pre-commit.ci fixes
  • Loading branch information
pre-commit-ci[bot] committed Mar 2, 2022
commit 1ba2f0b9823ee86b96983fb2fe47a9d986554644
4 changes: 2 additions & 2 deletions include/CLI/App.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2558,7 +2558,7 @@ class App {
continue;
}
}

parse_order_.push_back(opt.get());
/// if we require a separator add it here
if(opt->get_inject_separator()) {
Expand All @@ -2568,7 +2568,7 @@ class App {
}
if(opt->get_trigger_on_parse() &&
opt->current_option_state_ == Option::option_state::callback_run) {
opt->clear();
opt->clear();
}
opt->add_result(positional);
if(opt->get_trigger_on_parse()) {
Expand Down
4 changes: 2 additions & 2 deletions tests/OptionTypeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ TEST_CASE_METHOD(TApp, "floatPair", "[optiontype]") {
auto *opt = app.add_option("--fp", custom_opt)->delimiter(',');
opt->default_str("3.4,2.7");

args = {"--fp","12", "1.5"};
args = {"--fp", "12", "1.5"};

run();
CHECK(12.0f == Approx(custom_opt.first));
Expand Down Expand Up @@ -996,7 +996,7 @@ TEST_CASE_METHOD(TApp, "OnParseCallPositional", "[optiontype]") {
})
->trigger_on_parse()
->allow_extra_args();
args = { "1", "2", "3"};
args = {"1", "2", "3"};
CHECK(opt->get_trigger_on_parse());
run();
CHECK(3 == cnt);
Expand Down