Skip to content

Commit

Permalink
fix: quote list of args (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneskoester authored Mar 22, 2024
1 parent ba3bef2 commit 656ba0a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions snakemake_interface_executor_plugins/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,10 @@ def format_cli_pos_arg(value, quote=True):
elif not_iterable(value):
return format_cli_value(value)
else:
return join_cli_args(
format_cli_value(v, quote_if_contains_whitespace=True) for v in value
)
return join_cli_args(format_cli_value(v, quote=True) for v in value)


def format_cli_value(value: Any, quote_if_contains_whitespace: bool = False) -> str:
def format_cli_value(value: Any, quote: bool = False) -> str:
if isinstance(value, SettingsEnumBase):
return value.item_to_choice()
elif isinstance(value, Path):
Expand All @@ -54,8 +52,7 @@ def format_cli_value(value: Any, quote_if_contains_whitespace: bool = False) ->
if is_quoted(value):
# the value is already quoted, do not quote again
return value
elif quote_if_contains_whitespace and " " in value:
# may be expression
elif quote:
return repr(value)
else:
return value
Expand Down

0 comments on commit 656ba0a

Please sign in to comment.