summaryrefslogtreecommitdiff
path: root/cmd2.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-01-20 18:04:43 -0500
committerTodd Leonhardt <todd.leonhardt@gmail.com>2018-01-20 18:04:43 -0500
commitbd948d727e0e13fa5fd77199c06fcd3dfdda9b39 (patch)
treebbb7ae35cb76becccddfe7dd4258c87b2c463b68 /cmd2.py
parent5550ab73a91d2834e6bda72eb3889998ad59be51 (diff)
downloadcmd2-git-bd948d727e0e13fa5fd77199c06fcd3dfdda9b39.tar.gz
Added unit tests for newly-overridden complete() method
Also added a section on Sub-commands to the documentation.
Diffstat (limited to 'cmd2.py')
-rwxr-xr-xcmd2.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/cmd2.py b/cmd2.py
index a533bb7a..39522f27 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -803,6 +803,14 @@ class Cmd(cmd.Cmd):
If a command has not been entered, then complete against command list.
Otherwise try to call complete_<command> to get list of completions.
+
+ This method gets called directly by readline because it is set as the tab-completion function.
+
+ This completer function is called as complete(text, state), for state in 0, 1, 2, …, until it returns a
+ non-string value. It should return the next possible completion starting with text.
+
+ :param text: str - the current word that user is typing
+ :param state: int - non-negative integer
"""
if state == 0:
import readline