Skip to content

Commit 2b4f94f

Browse files
committed
Simplified code
1 parent 5116720 commit 2b4f94f

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

cmd2.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3106,13 +3106,12 @@ def complete_print(self, text, line, begidx, endidx):
31063106
begidx -= diff
31073107
endidx -= diff
31083108

3109-
# Call the subcommand specific completer
3109+
# Call the subcommand specific completer if it exists
31103110
completer = 'complete_{}_{}'.format(base, subcommand)
3111-
try:
3112-
compfunc = getattr(self, completer)
3111+
compfunc = getattr(self, completer, None)
3112+
3113+
if compfunc is not None:
31133114
matches = compfunc(text, line, begidx, endidx)
3114-
except AttributeError:
3115-
pass
31163115

31173116
return matches
31183117

0 commit comments

Comments
 (0)