summaryrefslogtreecommitdiff
path: root/cmd2/argparse_custom.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-09-20 16:35:17 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2019-09-20 16:35:17 -0400
commit1a34f350f7846ba1ed1397f862a2cba4fa7272b0 (patch)
treeb380455d71173bee93112397bb1e40aa2ed681e0 /cmd2/argparse_custom.py
parent1176c0cc99975044d2fcec88b3f0903b8453194f (diff)
downloadcmd2-git-1a34f350f7846ba1ed1397f862a2cba4fa7272b0.tar.gz
Added CompletionError exception class
Diffstat (limited to 'cmd2/argparse_custom.py')
-rw-r--r--cmd2/argparse_custom.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/cmd2/argparse_custom.py b/cmd2/argparse_custom.py
index 940d6064..4faddcab 100644
--- a/cmd2/argparse_custom.py
+++ b/cmd2/argparse_custom.py
@@ -221,6 +221,17 @@ def generate_range_error(range_min: int, range_max: Union[int, float]) -> str:
return err_str
+class CompletionError(Exception):
+ """
+ Raised during tab-completion operations to report any sort of error you want printed by the AutoCompleter
+
+ Example use cases
+ 1. Reading a database to retrieve a tab completion data set failed
+ 2. A previous command line argument that determines the data set being completed is invalid
+ """
+ pass
+
+
class CompletionItem(str):
"""
Completion item with descriptive text attached