summaryrefslogtreecommitdiff
path: root/cmd2.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2018-03-26 20:31:07 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2018-03-26 20:31:07 -0400
commit2b4f94f09bfeddd4a9a5f241eced3aff976371e5 (patch)
tree52ccc9c76490cf140d7948379422e0db83afd0b5 /cmd2.py
parent5116720d50d95094aa02210ea9875858c995d4c6 (diff)
downloadcmd2-git-2b4f94f09bfeddd4a9a5f241eced3aff976371e5.tar.gz
Simplified code
Diffstat (limited to 'cmd2.py')
-rwxr-xr-xcmd2.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/cmd2.py b/cmd2.py
index d38421be..3b99a18c 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -3106,13 +3106,12 @@ Usage: Usage: unalias [-a] name [name ...]
begidx -= diff
endidx -= diff
- # Call the subcommand specific completer
+ # Call the subcommand specific completer if it exists
completer = 'complete_{}_{}'.format(base, subcommand)
- try:
- compfunc = getattr(self, completer)
+ compfunc = getattr(self, completer, None)
+
+ if compfunc is not None:
matches = compfunc(text, line, begidx, endidx)
- except AttributeError:
- pass
return matches