diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-07-24 00:06:43 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-07-24 00:07:33 -0400 |
commit | ee1a598a51337ccb1b38bcb12008c06dfb94f1a9 (patch) | |
tree | 4a0b29262239d6e7072e6a9f2f3017b5baec183b /cmd2/cmd2.py | |
parent | 4f922049aab4df0393f513734cdc7594daca1991 (diff) | |
download | cmd2-git-ee1a598a51337ccb1b38bcb12008c06dfb94f1a9.tar.gz |
Tab completion of macros should occur before completion of commands with the same name
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r-- | cmd2/cmd2.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index f2da6726..56243037 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -1461,8 +1461,12 @@ class Cmd(cmd.Cmd): text = text_to_remove + text begidx = actual_begidx - # Check if a valid command was entered - if command in self.get_all_commands(): + # Check if a macro was entered + if command in self.macros: + compfunc = self.path_complete + + # Check if a command was entered + elif command in self.get_all_commands(): # Get the completer function for this command compfunc = getattr(self, 'complete_' + command, None) @@ -1478,11 +1482,7 @@ class Cmd(cmd.Cmd): else: compfunc = self.completedefault - # Check if a macro was entered - elif command in self.macros: - compfunc = self.path_complete - - # A valid command was not entered + # Not a recognized macro or command else: # Check if this command should be run as a shell command if self.default_to_shell and command in utils.get_exes_in_path(command): |