summaryrefslogtreecommitdiff
path: root/cmd2/cmd2.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-07-23 23:59:53 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2019-07-23 23:59:53 -0400
commit7f6dad1daa3626598a38a16ac373b9a8f4e472da (patch)
treece8036bd915451f6993c13e5fc41775d42e8ced7 /cmd2/cmd2.py
parent8ed685e54d897b00666581a07f0b889588a28bb1 (diff)
downloadcmd2-git-7f6dad1daa3626598a38a16ac373b9a8f4e472da.tar.gz
Removed restriction on macros named after non-multiline commands
Added unit tests
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r--cmd2/cmd2.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index 79e7aad8..f2da6726 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -1988,8 +1988,7 @@ class Cmd(cmd.Cmd):
suffix=statement.suffix,
pipe_to=statement.pipe_to,
output=statement.output,
- output_to=statement.output_to,
- )
+ output_to=statement.output_to)
return statement
def _resolve_macro(self, statement: Statement) -> Optional[str]:
@@ -2516,8 +2515,8 @@ class Cmd(cmd.Cmd):
self.perror("Invalid macro name: {}".format(errmsg))
return
- if args.name in self.get_all_commands():
- self.perror("Macro cannot have the same name as a command")
+ if args.name in self.statement_parser.multiline_commands:
+ self.perror("Macro cannot have the same name as a multiline command")
return
if args.name in self.aliases: