summaryrefslogtreecommitdiff
path: root/cmd2/argparse_custom.py
diff options
context:
space:
mode:
authorEric Lin <anselor@gmail.com>2020-08-12 13:08:59 -0400
committeranselor <anselor@gmail.com>2020-08-12 17:41:20 -0400
commit774fb39d7e259d0679c573b0d893293f9ed9aed9 (patch)
treea78a4693e7cca707668eb89b0d8e41c3fedd108e /cmd2/argparse_custom.py
parent4d628ea7573ef9016971dbbf7de9126c6d179227 (diff)
downloadcmd2-git-774fb39d7e259d0679c573b0d893293f9ed9aed9.tar.gz
Breaking change: Removed cmd2 app as a required second parameter to
CommandSet command functions (do_, complete_, help_). Renamed install_command_set and uninstall_command_set to register_command_set and unregister_command_set.
Diffstat (limited to 'cmd2/argparse_custom.py')
-rw-r--r--cmd2/argparse_custom.py11
1 files changed, 2 insertions, 9 deletions
diff --git a/cmd2/argparse_custom.py b/cmd2/argparse_custom.py
index 5dbb9f66..d724cb88 100644
--- a/cmd2/argparse_custom.py
+++ b/cmd2/argparse_custom.py
@@ -68,9 +68,9 @@ If bound to a cmd2.Cmd subclass, it will pass the app instance as the `self`
argument. This is good in cases where the list of choices being generated
relies on state data of the cmd2-based app.
If bound to a cmd2.CommandSet subclass, it will pass the CommandSet instance
-as the `self` argument, and the app instance as the positional argument.
+as the `self` argument.
- Example bound to cmd2.Cmd::
+ Example::
def my_choices_method(self):
...
@@ -78,13 +78,6 @@ as the `self` argument, and the app instance as the positional argument.
parser.add_argument("arg", choices_method=my_choices_method)
- Example bound to cmd2.CommandSEt::
-
- def my_choices_method(self, app: cmd2.Cmd):
- ...
- return my_generated_list
-
- parser.add_argument("arg", choices_method=my_choices_method)
``completer_function`` - pass a tab completion function that does custom
completion. Since custom tab completion operations commonly need to modify