summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-09-30 11:24:40 -0400
committerGitHub <noreply@github.com>2018-09-30 11:24:40 -0400
commit6ec2af3bc9f0fd82f80b91a7d38540fa930291f9 (patch)
tree0197298242cde0750a7a952b18552f3289e414ca
parent61d5703cd3586b3460669a6260cf903c9863b240 (diff)
parentee4c2d8fed20265a88eacf56cb4af6ab9fa32245 (diff)
downloadcmd2-git-6ec2af3bc9f0fd82f80b91a7d38540fa930291f9.tar.gz
Merge pull request #554 from python-cmd2/cleanup
Small refactoring
-rw-r--r--CHANGELOG.md2
-rw-r--r--cmd2/cmd2.py15
2 files changed, 6 insertions, 11 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d2d0adec..0e3d704d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,4 @@
-## 0.9.5 (September TBD, 2018)
+## 0.9.5 (October TBD, 2018)
* Bug Fixes
* Fixed bug where ``get_all_commands`` could return non-callable attributes
* Fixed bug where **alias** command was dropping quotes around arguments
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index dec0a04d..79d3c80a 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -2216,13 +2216,11 @@ class Cmd(cmd.Cmd):
args.name = utils.strip_quotes(args.name)
valid, errmsg = self.statement_parser.is_valid_command(args.name)
if not valid:
- errmsg = "Invalid alias name: {}".format(errmsg)
- self.perror(errmsg, traceback_war=False)
+ self.perror("Invalid alias name: {}".format(errmsg), traceback_war=False)
return
if args.name in self.macros:
- errmsg = "Alias cannot have the same name as a macro"
- self.perror(errmsg, traceback_war=False)
+ self.perror("Alias cannot have the same name as a macro", traceback_war=False)
return
utils.unquote_redirection_tokens(args.command_args)
@@ -2353,18 +2351,15 @@ class Cmd(cmd.Cmd):
args.name = utils.strip_quotes(args.name)
valid, errmsg = self.statement_parser.is_valid_command(args.name)
if not valid:
- errmsg = "Invalid macro name: {}".format(errmsg)
- self.perror(errmsg, traceback_war=False)
+ self.perror("Invalid macro name: {}".format(errmsg), traceback_war=False)
return
if args.name in self.get_all_commands():
- errmsg = "Macro cannot have the same name as a command"
- self.perror(errmsg, traceback_war=False)
+ self.perror("Macro cannot have the same name as a command", traceback_war=False)
return
if args.name in self.aliases:
- errmsg = "Macro cannot have the same name as an alias"
- self.perror(errmsg, traceback_war=False)
+ self.perror("Macro cannot have the same name as an alias", traceback_war=False)
return
utils.unquote_redirection_tokens(args.command_args)