summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd2/cmd2.py11
-rw-r--r--tests/test_cmd2.py5
2 files changed, 2 insertions, 14 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,
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index 22f250ac..74eb8c9b 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -1712,11 +1712,6 @@ def test_macro_create_with_alias_name(base_app):
out, err = run_cmd(base_app, 'macro create {} help'.format(macro))
assert "Macro cannot have the same name as an alias" in err[0]
-def test_macro_create_with_command_name(base_app):
- macro = "my_macro"
- out, err = run_cmd(base_app, 'macro create help stuff')
- assert "Macro cannot have the same name as a command" in err[0]
-
def test_macro_create_with_args(base_app):
# Create the macro
out, err = run_cmd(base_app, 'macro create fake {1} {2}')