summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd2/cmd2.py1
-rw-r--r--docs/features/completion.rst12
2 files changed, 13 insertions, 0 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index 8d9627aa..86e511c7 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -1826,6 +1826,7 @@ class Cmd(cmd.Cmd):
begidx += len(shortcut_to_restore)
break
else:
+ # No shortcut was found. Complete the command token.
parser = DEFAULT_ARGUMENT_PARSER(add_help=False)
parser.add_argument('command', metavar="COMMAND", help="command, alias, or macro name",
choices=self._get_commands_aliases_and_macros_for_completion())
diff --git a/docs/features/completion.rst b/docs/features/completion.rst
index 0e6bedd9..3894a4eb 100644
--- a/docs/features/completion.rst
+++ b/docs/features/completion.rst
@@ -89,6 +89,7 @@ completion hints.
.. _argparse-based:
+
Tab Completion Using argparse Decorators
----------------------------------------
@@ -132,6 +133,17 @@ any of the 3 completion parameters: ``choices``, ``choices_provider``, and
See the argparse_completion_ example or the implementation of the built-in
:meth:`~cmd2.Cmd.do_set` command for demonstration of how this is used.
+
+Custom Completion with ``read_input()``
+--------------------------------------------------
+
+``cmd2`` provides :attr:`cmd2.Cmd.read_input` as an alternative to Python's
+``input()`` function. ``read_input`` supports configurable tab completion and
+up-arrow history at the prompt. See read_input_ example for a demonstration.
+
+.. _read_input: https://github.com/python-cmd2/cmd2/blob/master/examples/read_input.py
+
+
For More Information
--------------------