summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2020-09-09 03:06:21 -0400
committerGitHub <noreply@github.com>2020-09-09 03:06:21 -0400
commitc50def1eff00f7f44adcb911d215ace65d16aa8a (patch)
tree62575c664a651027cea415cea574454d1e4637ca /docs
parenta975432ea87b8bde7d879f6e0974dcaffedc5f78 (diff)
parent1a2095e5c373430e5aa4bda2ee24f65f4527a002 (diff)
downloadcmd2-git-c50def1eff00f7f44adcb911d215ace65d16aa8a.tar.gz
Merge pull request #991 from python-cmd2/read_input
Read input enhancements
Diffstat (limited to 'docs')
-rw-r--r--docs/api/utils.rst27
-rw-r--r--docs/features/completion.rst12
2 files changed, 39 insertions, 0 deletions
diff --git a/docs/api/utils.rst b/docs/api/utils.rst
index 188f5b16..9276587f 100644
--- a/docs/api/utils.rst
+++ b/docs/api/utils.rst
@@ -36,6 +36,33 @@ IO Handling
:members:
+Tab Completion
+--------------
+
+.. autoclass:: cmd2.utils.CompletionMode
+
+ .. attribute:: NONE
+
+ Tab completion will be disabled during read_input() call. Use of custom
+ up-arrow history supported.
+
+ .. attribute:: COMMANDS
+
+ read_input() will tab complete cmd2 commands and their arguments.
+ cmd2's command line history will be used for up arrow if history is not
+ provided. Otherwise use of custom up-arrow history supported.
+
+ .. attribute:: CUSTOM
+
+ read_input() will tab complete based on one of its following parameters
+ (choices, choices_provider, completer, parser). Use of custom up-arrow
+ history supported
+
+.. autoclass:: cmd2.utils.CustomCompletionSettings
+
+ .. automethod:: __init__
+
+
Text Alignment
--------------
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
--------------------