File tree 2 files changed +16
-11
lines changed
2 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -66,9 +66,6 @@ def parse_arg_list_to_command_invocation(
66
66
command , flags_options_operands
67
67
) -> CommandInvocationInitial :
68
68
cmd_name = format_arg_chars (command )
69
- #strip quotes from command where necessary
70
- #quoted commands are interpreted as non-parallelizable
71
- cmd_name = cmd_name .strip ().strip ('"' ).strip ("'" )
72
69
json_data = get_json_data (cmd_name )
73
70
set_of_all_flags : Set [str ] = get_set_of_all_flags (json_data )
74
71
dict_flag_to_primary_repr : dict [str , str ] = get_dict_flag_to_primary_repr (json_data )
Original file line number Diff line number Diff line change @@ -44,15 +44,23 @@ def __init__(self, text):
44
44
def check_if_ast_is_supported (construct , arguments , ** kwargs ):
45
45
return
46
46
47
-
48
- def format_args (args ):
49
- formatted_args = [format_arg_chars (arg_chars ) for arg_chars in args ]
50
- return formatted_args
51
-
52
-
53
47
def format_arg_chars (arg_chars ):
54
- chars = [format_arg_char (arg_char ) for arg_char in arg_chars ]
55
- return "" .join (chars )
48
+ return traverse_and_format (arg_chars )
49
+
50
+ def traverse_and_format (arg_char ):
51
+ if isinstance (arg_char , list ):
52
+ return "" .join (traverse_and_format (c ) for c in arg_char )
53
+ elif isinstance (arg_char , QArgChar ):
54
+ return remove_quotes_from_quoted_content (arg_char .format ())
55
+ elif isinstance (arg_char , (CArgChar , EArgChar )):
56
+ return format_arg_char (arg_char )
57
+ else :
58
+ # Fallback: not sure what the fallback for non recognized characters should be?
59
+ return format_arg_char (arg_char )
60
+
61
+ def remove_quotes_from_quoted_content (arg_char ):
62
+ formatted_content = traverse_and_format (arg_char )
63
+ return formatted_content .strip ('"' ).strip ("'" )
56
64
57
65
58
66
def format_arg_char (arg_char : ArgChar ) -> str :
You can’t perform that action at this time.
0 commit comments