Skip to content

Commit e591f4a

Browse files
authored
ensure the parse order is reset on clear() (#1218)
Fixes #1216
1 parent e83695f commit e591f4a

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

include/CLI/impl/App_inl.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,7 @@ CLI11_INLINE void App::clear() {
582582

583583
missing_.clear();
584584
parsed_subcommands_.clear();
585+
parse_order_.clear();
585586
for(const Option_p &opt : options_) {
586587
opt->clear();
587588
}

tests/AppTest.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2016,6 +2016,8 @@ TEST_CASE_METHOD(TApp, "OriginalOrder", "[app]") {
20162016
CHECK(std::vector<int>({2}) == st2);
20172017

20182018
CHECK(std::vector<CLI::Option *>({op1, op2, op1, op1}) == app.parse_order());
2019+
app.clear();
2020+
CHECK(app.parse_order().empty());
20192021
}
20202022

20212023
TEST_CASE_METHOD(TApp, "NeedsFlags", "[app]") {

0 commit comments

Comments
 (0)