From 774fb39d7e259d0679c573b0d893293f9ed9aed9 Mon Sep 17 00:00:00 2001 From: Eric Lin Date: Wed, 12 Aug 2020 13:08:59 -0400 Subject: 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. --- cmd2/argparse_custom.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'cmd2/argparse_custom.py') 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 -- cgit v1.2.1