summaryrefslogtreecommitdiff
path: root/cmd2/utils.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-05-05 22:31:45 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2019-05-05 22:31:45 -0400
commit8801b8cba5dc8c91b22d502b6d82959531cb596e (patch)
treeab97389b6ba25371ead77385d526b125dee60a36 /cmd2/utils.py
parent7a08201916b5862e8e51d3398a9fec1e5dff354f (diff)
downloadcmd2-git-8801b8cba5dc8c91b22d502b6d82959531cb596e.tar.gz
Broke _complete_statement into 2 functions.
Fixed issue where terminators could not be used in alias/macro values.
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