diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-05-02 00:21:02 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-05-02 00:21:02 -0400 |
commit | 1bade4202d9a8df2be9561bc8d3a9cb26fefd7b0 (patch) | |
tree | a78cd5b362fe8d7030859e0d7e21e800a726cf19 /cmd2/cmd2.py | |
parent | 9c7e400d69852f9d490f2e38771e15087d52103e (diff) | |
download | cmd2-git-1bade4202d9a8df2be9561bc8d3a9cb26fefd7b0.tar.gz |
Macros can now share their name with a command
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r-- | cmd2/cmd2.py | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 2c0103ee..1557592b 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -2410,10 +2410,6 @@ class Cmd(cmd.Cmd): self.perror("Invalid macro name: {}".format(errmsg), traceback_war=False) return - if args.name in self.get_all_commands(): - self.perror("Macro cannot have the same name as a command", traceback_war=False) - return - if args.name in self.aliases: self.perror("Macro cannot have the same name as an alias", traceback_war=False) return @@ -2546,16 +2542,13 @@ class Cmd(cmd.Cmd): "\n" " macro create backup !cp \"{1}\" \"{1}.orig\"\n" "\n" - " Be careful! Since macros can resolve into commands, aliases, and macros,\n" - " it is possible to create a macro that results in infinite recursion.\n" - "\n" " If you want to use redirection or pipes in the macro, then quote them as in\n" " this example to prevent the 'macro create' command from being redirected.\n" "\n" " macro create show_results print_results -type {1} \"|\" less\n" "\n" - " Because macros do not resolve until after parsing (hitting Enter), tab\n" - " completion will only complete paths.") + " Because macros do not resolve until after hitting Enter, tab completion\n" + " will only complete paths while entering a macro.") macro_create_parser = macro_subparsers.add_parser('create', help=macro_create_help, description=macro_create_description, |