Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: quote list of args #62

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading