Fix for another subaction argument-parsing edge case (#712).
This commit is contained in:
parent
147516ae3f
commit
248f82d6f6
2 changed files with 17 additions and 7 deletions
|
@ -161,17 +161,21 @@ def parse_arguments_for_actions(unparsed_arguments, action_parsers):
|
|||
|
||||
subaction_parsers = get_subaction_parsers(action_parser)
|
||||
|
||||
# Parse with subaction parsers, if any.
|
||||
# But first parse with subaction parsers, if any.
|
||||
if subaction_parsers:
|
||||
subactions_parsed = False
|
||||
|
||||
for subaction_name, subaction_parser in subaction_parsers.items():
|
||||
remaining_action_arguments.append(
|
||||
parse_and_record_action_arguments(
|
||||
unparsed_arguments,
|
||||
arguments,
|
||||
subaction_parser,
|
||||
subaction_name,
|
||||
tuple(
|
||||
argument
|
||||
for argument in parse_and_record_action_arguments(
|
||||
unparsed_arguments,
|
||||
arguments,
|
||||
subaction_parser,
|
||||
subaction_name,
|
||||
)
|
||||
if argument != action_name
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -587,7 +587,13 @@ def test_parse_arguments_config_with_subaction_and_required_flags_does_not_raise
|
|||
module.parse_arguments('config', 'bootstrap', '--repository', 'repo.borg')
|
||||
|
||||
|
||||
def test_parse_arguments_config_with_subaction_and_global_flags_does_not_raise(capsys):
|
||||
def test_parse_arguments_config_with_subaction_and_global_flags_at_start_does_not_raise(capsys):
|
||||
flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
|
||||
|
||||
module.parse_arguments('--verbosity', '1', 'config', 'bootstrap', '--repository', 'repo.borg')
|
||||
|
||||
|
||||
def test_parse_arguments_config_with_subaction_and_global_flags_at_end_does_not_raise(capsys):
|
||||
flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
|
||||
|
||||
module.parse_arguments('config', 'bootstrap', '--repository', 'repo.borg', '--verbosity', '1')
|
||||
|
|
Loading…
Reference in a new issue