summaryrefslogtreecommitdiff
path: root/cmd2/cmd2.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2018-09-26 14:08:23 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2018-09-26 14:08:23 -0400
commite88b9a6914e4435643df10b7a51695f914a3dc1a (patch)
tree658186a2534b885aa4976be6d1c4b76e6c53e32b /cmd2/cmd2.py
parent67e69cf1137b31c01dbc239af6aecd0c265ffb40 (diff)
downloadcmd2-git-e88b9a6914e4435643df10b7a51695f914a3dc1a.tar.gz
Made function to unquote redirection characters
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r--cmd2/cmd2.py20
1 files changed, 6 insertions, 14 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index 8b7262a2..90ef0ac6 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -2252,16 +2252,12 @@ class Cmd(cmd.Cmd):
self.perror(errmsg, traceback_war=False)
return
- # Unquote redirection and pipes
- for i, arg in enumerate(args.command_args):
- unquoted_arg = utils.strip_quotes(arg)
- if unquoted_arg in constants.REDIRECTION_TOKENS:
- args.command_args[i] = unquoted_arg
+ utils.unquote_redirection_tokens(args.command_args)
# Build the alias value string
- value = utils.quote_string_if_needed(args.command)
+ value = args.command
for cur_arg in args.command_args:
- value += ' ' + utils.quote_string_if_needed(cur_arg)
+ value += ' ' + cur_arg
# Set the alias
result = "overwritten" if args.name in self.aliases else "created"
@@ -2400,16 +2396,12 @@ class Cmd(cmd.Cmd):
self.perror(errmsg, traceback_war=False)
return
- # Unquote redirection and pipes
- for i, arg in enumerate(args.command_args):
- unquoted_arg = utils.strip_quotes(arg)
- if unquoted_arg in constants.REDIRECTION_TOKENS:
- args.command_args[i] = unquoted_arg
+ utils.unquote_redirection_tokens(args.command_args)
# Build the macro value string
- value = utils.quote_string_if_needed(args.command)
+ value = args.command
for cur_arg in args.command_args:
- value += ' ' + utils.quote_string_if_needed(cur_arg)
+ value += ' ' + cur_arg
# Find all normal arguments
arg_list = []