diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-05-15 23:41:00 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-15 23:41:00 -0400 |
commit | a9b712108e5af49937b0af3aa51db2ebe5c159e4 (patch) | |
tree | cf21f698da9dc768f41a37278e1044fd1bd96f85 | |
parent | b48d6b5eadfc6457acfcc578e21edcf9b86862cc (diff) | |
parent | c76a8ac29f383274e63d3aa52b7346dae208d587 (diff) | |
download | cmd2-git-a9b712108e5af49937b0af3aa51db2ebe5c159e4.tar.gz |
Merge pull request #400 from python-cmd2/complete_alias
Completing alias names in value field of alias command since aliases …
-rwxr-xr-x | cmd2/cmd2.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 43fd99ec..9cbbd639 100755 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -2142,13 +2142,15 @@ Usage: Usage: alias [name] | [<name> <value>] errmsg = "Aliases can not contain: {}".format(invalidchars) self.perror(errmsg, traceback_war=False) - def complete_alias(self, text, line, begidx, endidx): """ Tab completion for alias """ + alias_names = set(self.aliases.keys()) + visible_commands = set(self.get_visible_commands()) + index_dict = \ { - 1: self.aliases, - 2: self.get_visible_commands() + 1: alias_names, + 2: list(alias_names | visible_commands) } return self.index_based_complete(text, line, begidx, endidx, index_dict, self.path_complete) |