summaryrefslogtreecommitdiff
path: root/cmd2/utils.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/utils.py
parent67e69cf1137b31c01dbc239af6aecd0c265ffb40 (diff)
downloadcmd2-git-e88b9a6914e4435643df10b7a51695f914a3dc1a.tar.gz
Made function to unquote redirection characters
Diffstat (limited to 'cmd2/utils.py')
-rw-r--r--cmd2/utils.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/cmd2/utils.py b/cmd2/utils.py
index 3527236f..a20f0b66 100644
--- a/cmd2/utils.py
+++ b/cmd2/utils.py
@@ -304,3 +304,15 @@ class StdSim(object):
return self.__dict__[item]
else:
return getattr(self.inner_stream, item)
+
+
+def unquote_redirection_tokens(args: List[str]) -> None:
+ """
+ Used to unquote redirection tokens in a list of command line arguments
+ This is used when redirection tokens have to be passed to another command
+ :param args: the command line args
+ """
+ for i, arg in enumerate(args):
+ unquoted_arg = strip_quotes(arg)
+ if unquoted_arg in constants.REDIRECTION_TOKENS:
+ args[i] = unquoted_arg