diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-03-31 03:48:31 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-03-31 03:48:31 -0400 |
commit | 0724d38c9efe36400b776454d01d081f3db7ee63 (patch) | |
tree | a4244193de83888ba6d4d89c9fb953d23b1466dc /cmd2.py | |
parent | ad76ceccbc6d4df553822d586b633ffb13fba4a6 (diff) | |
download | cmd2-git-0724d38c9efe36400b776454d01d081f3db7ee63.tar.gz |
Allow an alias name to match a command name
Diffstat (limited to 'cmd2.py')
-rwxr-xr-x | cmd2.py | 12 |
1 files changed, 3 insertions, 9 deletions
@@ -2105,9 +2105,9 @@ class Cmd(cmd.Cmd): else: # Complete token against aliases and command names - alias_names = list(self.aliases.keys()) - visible_commands = self.get_visible_commands() - strs_to_match = alias_names + visible_commands + alias_names = set(self.aliases.keys()) + visible_commands = set(self.get_visible_commands()) + strs_to_match = list(alias_names | visible_commands) self.completion_matches = self.basic_complete(text, line, begidx, endidx, strs_to_match) # Handle single result @@ -2755,12 +2755,6 @@ Usage: Usage: alias [<name> <value>] name = arglist[0] value = ' '.join(arglist[1:]) - # Make sure the alias does not match an existing command - cmd_func = self._func_named(name) - if cmd_func is not None: - self.perror("Alias names cannot match an existing command: {!r}".format(name), traceback_war=False) - return - # Check for a valid name for cur_char in name: if cur_char not in self.identchars: |