mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-05-02 13:43:52 +00:00
Fix #23: Respect fallthrough_ in _valid_subcommand
_valid_subcommand checks whether its argument appears to be a valid subcommand name or not; however, if it doesn't recognize the name, it always checks if its parent does. As described in in issue #23, this can cause incorrect behavior. To avoid this, check if fallthrough is disabled first, and do not consult the parent's known subcommands if fallthrough is disabled.
This commit is contained in:
parent
363571beb1
commit
cb906d1aab
@ -857,7 +857,7 @@ class App {
|
||||
for(const App_p &com : subcommands_)
|
||||
if(com->check_name(current))
|
||||
return true;
|
||||
if(parent_ != nullptr)
|
||||
if(parent_ != nullptr && fallthrough_)
|
||||
return parent_->_valid_subcommand(current);
|
||||
else
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user