summaryrefslogtreecommitdiff
path: root/cmd2.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2018-03-31 03:48:31 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2018-03-31 03:48:31 -0400
commit0724d38c9efe36400b776454d01d081f3db7ee63 (patch)
treea4244193de83888ba6d4d89c9fb953d23b1466dc /cmd2.py
parentad76ceccbc6d4df553822d586b633ffb13fba4a6 (diff)
downloadcmd2-git-0724d38c9efe36400b776454d01d081f3db7ee63.tar.gz
Allow an alias name to match a command name
Diffstat (limited to 'cmd2.py')
-rwxr-xr-xcmd2.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/cmd2.py b/cmd2.py
index 4453ea15..7b2ed2ea 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -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: