summaryrefslogtreecommitdiff
path: root/cmd2
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2020-04-23 18:19:08 -0400
committerGitHub <noreply@github.com>2020-04-23 18:19:08 -0400
commit9c7bbfa5bdbf8c8d81c0cd3c3cd5179d700de0b2 (patch)
tree33169eca113b07a891ef4fcdb70a4bb409b5b4a4 /cmd2
parentecf154f1b13e41644fefd3db624aae1d8c1e0d2a (diff)
parent502fdff29b755bec83808352db8777e6e1057757 (diff)
downloadcmd2-git-9c7bbfa5bdbf8c8d81c0cd3c3cd5179d700de0b2.tar.gz
Merge pull request #929 from python-cmd2/completion_docs
Completion docs
Diffstat (limited to 'cmd2')
-rw-r--r--cmd2/argparse_custom.py21
-rw-r--r--cmd2/utils.py8
2 files changed, 13 insertions, 16 deletions
diff --git a/cmd2/argparse_custom.py b/cmd2/argparse_custom.py
index 5c3d6223..f018f33f 100644
--- a/cmd2/argparse_custom.py
+++ b/cmd2/argparse_custom.py
@@ -188,18 +188,15 @@ and will not include the description value of the CompletionItems.
**Patched argparse functions**
-argparse._ActionsContainer.add_argument - adds arguments related to tab
- completion and enables nargs range
- parsing See _add_argument_wrapper for
- more details on these argument
-
-argparse.ArgumentParser._get_nargs_pattern - adds support to for nargs ranges
- See _get_nargs_pattern_wrapper for
- more details
-
-argparse.ArgumentParser._match_argument - adds support to for nargs ranges See
- _match_argument_wrapper for more
- details
+``argparse._ActionsContainer.add_argument`` - adds arguments related to tab
+completion and enables nargs range parsing. See _add_argument_wrapper for
+more details on these arguments.
+
+``argparse.ArgumentParser._get_nargs_pattern`` - adds support to for nargs
+ranges. See _get_nargs_pattern_wrapper for more details.
+
+``argparse.ArgumentParser._match_argument`` - adds support to for nargs ranges.
+See _match_argument_wrapper for more details.
"""
import argparse
diff --git a/cmd2/utils.py b/cmd2/utils.py
index 3fd9e3ac..5a4fdbf7 100644
--- a/cmd2/utils.py
+++ b/cmd2/utils.py
@@ -74,12 +74,12 @@ def str_to_bool(val: str) -> bool:
class CompletionError(Exception):
"""
- Raised during tab completion operations to report any sort of error you want printed by the ArgparseCompleter
- This can also be used just to display a message, even if it's not an error. ArgparseCompleter raises
- CompletionErrors to display tab completion hints and sets apply_style to False so hints aren't colored
- like error text.
+ Raised during tab completion operations to report any sort of error you want printed. This can also be used
+ just to display a message, even if it's not an error. For instance, ArgparseCompleter raises CompletionErrors
+ to display tab completion hints and sets apply_style to False so hints aren't colored like error text.
Example use cases
+
- Reading a database to retrieve a tab completion data set failed
- A previous command line argument that determines the data set being completed is invalid
- Tab completion hints