summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd2/cmd2.py9
-rw-r--r--cmd2/parsing.py2
2 files changed, 6 insertions, 5 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index 604ac617..ccf463b2 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -2228,13 +2228,14 @@ class Cmd(cmd.Cmd):
self.perror(errmsg, traceback_war=False)
return
- if not args.command:
+ stripped_command = args.command.strip()
+ if not stripped_command:
errmsg = "An alias cannot resolve to an empty string"
self.perror(errmsg, traceback_war=False)
return
# Build the alias command string
- command = args.command + ' ' + ' '.join(utils.quote_string_if_needed(args.command_args))
+ command = stripped_command + ' ' + ' '.join(utils.quote_string_if_needed(args.command_args))
# Set the alias
self.aliases[args.name] = command
@@ -2290,8 +2291,8 @@ class Cmd(cmd.Cmd):
alias_subparsers = alias_parser.add_subparsers()
# alias -> create
- alias_create_help = "define an alias"
- alias_create_description = "Define an alias"
+ alias_create_help = "create or overwrite an alias"
+ alias_create_description = "Create or overwrite an alias"
alias_create_epilog = "Notes:\n"
alias_create_epilog += " If you want to use redirection or pipes in the alias, then quote them to prevent\n"
diff --git a/cmd2/parsing.py b/cmd2/parsing.py
index e8b2aaaa..c21da920 100644
--- a/cmd2/parsing.py
+++ b/cmd2/parsing.py
@@ -264,7 +264,7 @@ class StatementParser:
valid = False
if not word:
- return False, 'cannot be empty'
+ return False, 'cannot be an empty string'
errmsg = 'cannot start with a shortcut: '
errmsg += ', '.join(shortcut for (shortcut, expansion) in self.shortcuts)