summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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