Skip to content

Handle mutually exclusive group in AutoCompleter #777

@kmvanbrunt

Description

@kmvanbrunt

AutoCompleter should be improved to keep track of what arg was used in a mutually exclusive group and not offer to tab complete the other args in the group.

While these groups typically just include flags, it is possible to a have a positional as in the following case.

parser = Cmd2ArgumentParser()

group = parser.add_mutually_exclusive_group(required=True)
group.add_argument('optional_pos', nargs=argparse.OPTIONAL) 
group.add_argument('--flag')

parser.add_argument('required_pos')

If --flag had been used, then AutoCompleter would need to skip over optional_pos to required_pos.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions