summaryrefslogtreecommitdiff
path: root/cmd2/utils.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-05-07 22:17:01 -0400
committerGitHub <noreply@github.com>2019-05-07 22:17:01 -0400
commitf9ea58edbbe27ba5bcea2534263c992e8a2c7ab8 (patch)
tree22abcd45f892abd9e2e5b6e0a2a7874180538b89 /cmd2/utils.py
parent46f0aed0b66f45d08ef7fa8b16f787dc79ea32b1 (diff)
parentdb1f35fb39822fcf0b3a793a8fc2061fdeb66804 (diff)
downloadcmd2-git-f9ea58edbbe27ba5bcea2534263c992e8a2c7ab8.tar.gz
Merge pull request #670 from python-cmd2/macro_refactor
Macro refactor
Diffstat (limited to 'cmd2/utils.py')
-rw-r--r--cmd2/utils.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/cmd2/utils.py b/cmd2/utils.py
index 44a58c35..e8e8a611 100644
--- a/cmd2/utils.py
+++ b/cmd2/utils.py
@@ -262,15 +262,16 @@ def natural_sort(list_to_sort: Iterable[str]) -> List[str]:
return sorted(list_to_sort, key=natural_keys)
-def unquote_redirection_tokens(args: List[str]) -> None:
+def unquote_specific_tokens(args: List[str], tokens_to_unquote: List[str]) -> None:
"""
- Unquote redirection tokens in a list of command-line arguments
- This is used when redirection tokens have to be passed to another command
+ Unquote a specific tokens in a list of command-line arguments
+ This is used when certain tokens have to be passed to another command
:param args: the command line args
+ :param tokens_to_unquote: the tokens, which if present in args, to unquote
"""
for i, arg in enumerate(args):
unquoted_arg = strip_quotes(arg)
- if unquoted_arg in constants.REDIRECTION_TOKENS:
+ if unquoted_arg in tokens_to_unquote:
args[i] = unquoted_arg