summaryrefslogtreecommitdiff
path: root/docs/features/completion.rst
diff options
context:
space:
mode:
Diffstat (limited to 'docs/features/completion.rst')
-rw-r--r--docs/features/completion.rst24
1 files changed, 12 insertions, 12 deletions
diff --git a/docs/features/completion.rst b/docs/features/completion.rst
index 14a98caf..a8c1cc85 100644
--- a/docs/features/completion.rst
+++ b/docs/features/completion.rst
@@ -1,7 +1,7 @@
Completion
==========
-``cmd2`` adds tab-completion of file system paths for all built-in commands
+``cmd2`` adds tab completion of file system paths for all built-in commands
where it makes sense, including:
- ``edit``
@@ -9,7 +9,7 @@ where it makes sense, including:
- ``run_script``
- ``shell``
-``cmd2`` also adds tab-completion of shell commands to the ``shell`` command.
+``cmd2`` also adds tab completion of shell commands to the ``shell`` command.
Additionally, it is trivial to add identical file system path completion to
your own custom commands. Suppose you have defined a custom command ``foo`` by
@@ -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
@@ -37,9 +37,9 @@ Tab Completion Using Argparse Decorators
----------------------------------------
When using one the Argparse-based :ref:`api/decorators:Decorators`, ``cmd2``
-provides automatic tab-completion of flag names.
+provides automatic tab completion of flag names.
-Tab-completion of argument values can be configured by using one of five
+Tab completion of argument values can be configured by using one of five
parameters to ``argparse.ArgumentParser.add_argument()``
- ``choices``
@@ -47,26 +47,26 @@ 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
+When tab completing flags and/or argument values for a ``cmd2`` command using
one of these decorators, ``cmd2`` keeps track of state so that once a flag has
-already previously been provided, it won't attempt to tab-complete it again.
+already previously been provided, it won't attempt to tab complete it again.
When no completion results exists, a hint for the current argument will be
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
------------------------------------------
-When tab-completing things like a unique ID from a database, it can often be
+When tab completing things like a unique ID from a database, it can often be
beneficial to provide the user with some extra context about the item being
completed, such as a description. To facilitate this, ``cmd2`` defines the
``CompletionItem`` class which can be returned from any of the 4 completion
@@ -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.