diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-02-05 21:27:36 -0500 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-02-05 21:27:36 -0500 |
commit | 5997d96dd2e17a9e84af8a515313a02e546c27e0 (patch) | |
tree | 63665e5ba186f850d2237db61903d94a62176790 | |
parent | de12ee4782799350233be7adadeac08907c13e84 (diff) | |
download | cmd2-git-5997d96dd2e17a9e84af8a515313a02e546c27e0.tar.gz |
Fixing tab-completion hints when completing the value field of set
-rw-r--r-- | cmd2/cmd2.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 5579be4b..9f304537 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -2828,7 +2828,11 @@ class Cmd(cmd.Cmd): # Create a parser with a value field based on this settable settable_parser = DEFAULT_ARGUMENT_PARSER(parents=[Cmd.set_parser_parent]) - settable_parser.add_argument('value', help=settable.description, + + # Settables that populate choices have the values of those choices overwrite the arg name + # in help text and this shows in tab-completion hints. Set metavar to avoid this. + arg_name = 'value' + settable_parser.add_argument(arg_name, metavar=arg_name, help=settable.description, choices=settable.choices, choices_function=settable.choices_function, choices_method=settable.choices_method, |