diff options
| author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-03-24 00:44:33 -0400 |
|---|---|---|
| committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-03-24 00:44:33 -0400 |
| commit | 94000bf063e28bb20c82177c82a31cee5b0c2817 (patch) | |
| tree | f51c9fb57a2ac51e8b7444cfb67ad587f6d5e8fb /cmd2.py | |
| parent | ab865b425866556ca0a2117b9d24582e78d46688 (diff) | |
| download | cmd2-git-94000bf063e28bb20c82177c82a31cee5b0c2817.tar.gz | |
Reversed logic for readability
Diffstat (limited to 'cmd2.py')
| -rwxr-xr-x | cmd2.py | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -1930,15 +1930,7 @@ class Cmd(cmd.Cmd): return self.completion_matches[state] # Check if a valid command was entered - if command not in self.get_all_commands(): - # Check if this command should be run as a shell command - if self.default_to_shell and command in get_exes_in_path(command): - compfunc = functools.partial(path_complete) - else: - compfunc = self.completedefault - - # A valid command was entered - else: + if command in self.get_all_commands(): # Get the completer function for this command try: compfunc = getattr(self, 'complete_' + command) @@ -1954,6 +1946,14 @@ class Cmd(cmd.Cmd): index_dict=index_dict, all_else=compfunc) + # A valid command was not entered + else: + # Check if this command should be run as a shell command + if self.default_to_shell and command in get_exes_in_path(command): + compfunc = functools.partial(path_complete) + else: + compfunc = self.completedefault + # Call the completer function self.completion_matches = compfunc(text, line, begidx, endidx) |
