summaryrefslogtreecommitdiff
path: root/cmd2/argparse_custom.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-09-16 15:36:39 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2019-09-16 15:36:39 -0400
commite6585d155810f9afb2a246a71f939e1c0d511694 (patch)
tree1d41d0c8e2cdd6a1ff50edbdf48f50a3b22892b4 /cmd2/argparse_custom.py
parent9a7818b5a0e22e4ee5b107f6fdcceb3d3612ffd4 (diff)
downloadcmd2-git-e6585d155810f9afb2a246a71f939e1c0d511694.tar.gz
Changed arg_tokens to a dictionary
Including tokens from parent parsers in arg_tokens when subcommands are used
Diffstat (limited to 'cmd2/argparse_custom.py')
-rw-r--r--cmd2/argparse_custom.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/cmd2/argparse_custom.py b/cmd2/argparse_custom.py
index 59a00f4c..940d6064 100644
--- a/cmd2/argparse_custom.py
+++ b/cmd2/argparse_custom.py
@@ -103,17 +103,17 @@ Tab Completion:
set_completer_method(action, method)
There are times when what's being tab completed is determined by a previous argument on the command line.
- In theses cases, Autocompleter can pass an argparse Namespace that maps the command line tokens up through the
- one being completed to their argparse argument. To receive this Namespace, your choices/completer function
+ In theses cases, Autocompleter can pass a dictionary that maps the command line tokens up through the one
+ being completed to their argparse argument name. To receive this dictionary, your choices/completer function
should have an argument called arg_tokens.
Example:
def my_choices_method(self, arg_tokens)
def my_completer_method(self, text, line, begidx, endidx, arg_tokens)
- All members of the arg_tokens Namespace are lists, even if a particular argument expects only 1 token. Since
+ All values of the arg_tokens dictionary are lists, even if a particular argument expects only 1 token. Since
AutoCompleter is for tab completion, it does not convert the tokens to their actual argument types or validate
- their values. All tokens are stored in the Namespace as the raw strings provided on the command line. It is up to
+ their values. All tokens are stored in the dictionary as the raw strings provided on the command line. It is up to
the developer to determine if the user entered the correct argument type (e.g. int) and validate their values.
CompletionItem Class: