diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-02-12 15:47:29 -0500 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-02-12 15:47:29 -0500 |
commit | 191f94abda1c4d565ea5b2dd1bd66e346db3b51b (patch) | |
tree | 8bf9b0bfa7a49dd4713e8b31616275cab5cd87c9 /docs/features | |
parent | ad0e2ae0d0d426fe08353fd82d1f9ff051be9108 (diff) | |
download | cmd2-git-191f94abda1c4d565ea5b2dd1bd66e346db3b51b.tar.gz |
Overhauling tab completion examples
Diffstat (limited to 'docs/features')
-rw-r--r-- | docs/features/argument_processing.rst | 3 | ||||
-rw-r--r-- | docs/features/completion.rst | 10 |
2 files changed, 6 insertions, 7 deletions
diff --git a/docs/features/argument_processing.rst b/docs/features/argument_processing.rst index 9d98ea93..39a39804 100644 --- a/docs/features/argument_processing.rst +++ b/docs/features/argument_processing.rst @@ -328,11 +328,10 @@ You may add multiple layers of subcommands for your command. ``cmd2`` will automatically traverse and tab-complete subcommands for all commands using argparse. -See the subcommands_ and tab_autocompletion_ example to learn more about how to +See the subcommands_ example to learn more about how to use subcommands in your ``cmd2`` application. .. _subcommands: https://github.com/python-cmd2/cmd2/blob/master/examples/subcommands.py -.. _tab_autocompletion: https://github.com/python-cmd2/cmd2/blob/master/examples/tab_autocompletion.py Argparse Extensions diff --git a/docs/features/completion.rst b/docs/features/completion.rst index 14a98caf..9103b543 100644 --- a/docs/features/completion.rst +++ b/docs/features/completion.rst @@ -17,7 +17,7 @@ implementing the ``do_foo`` method. To enable path completion for the ``foo`` command, then add a line of code similar to the following to your class which inherits from ``cmd2.Cmd``:: - complete_foo = self.path_complete + complete_foo = cmd2.Cmd.path_complete This will effectively define the ``complete_foo`` readline completer method in your class and make it utilize the same path completion logic as the built-in @@ -47,9 +47,9 @@ parameters to ``argparse.ArgumentParser.add_argument()`` - ``completer_function`` / ``completer_method`` See the arg_decorators_ or colors_ example for a demonstration of how to -use the ``choices`` parameter. See the tab_autocompletion_ example for a +use the ``choices`` parameter. See the argparse_completion_ example for a demonstration of how to use the ``choices_function`` and ``choices_method`` -parameters. See the arg_decorators_ or tab_autocompletion_ example for a +parameters. See the arg_decorators_ or argparse_completion_ example for a demonstration of how to use the ``completer_method`` parameter. When tab-completing flags and/or argument values for a ``cmd2`` command using @@ -60,7 +60,7 @@ displayed to help the user. .. _arg_decorators: https://github.com/python-cmd2/cmd2/blob/master/examples/arg_decorators.py .. _colors: https://github.com/python-cmd2/cmd2/blob/master/examples/colors.py -.. _tab_autocompletion: https://github.com/python-cmd2/cmd2/blob/master/examples/tab_autocompletion.py +.. _argparse_completion: https://github.com/python-cmd2/cmd2/blob/master/examples/argparse_completion.py CompletionItem For Providing Extra Context @@ -76,5 +76,5 @@ or ``completion_method``. .. autoclass:: cmd2.argparse_custom.CompletionItem :members: -See the tab_autocompletion_ example or the implementation of the built-in +See the argparse_completion_ example or the implementation of the built-in **set** command for demonstration of how this is used. |