Skip to content

Conversation

@peterdemin
Copy link
Contributor

Currently, printing baked commands doesn't represent the way arguments are actually passed down to the program when values contain spaces.

The solution is to take such values in single quotes.

This is primarily to be able to copy printed commands and run them in a shell.

BEFORE:

>>> from sh import ls
>>> print(ls.bake('How I Met Your Mother'))
/bin/ls How I Met Your Mother

AFTER:

>>> print(ls.bake('How I Met Your Mother'))
/bin/ls 'How I Met Your Mother'

Currently, printing baked commands doesn't represent the way arguments
are actually passed down to the program when values contain spaces.

The solution is to take such values in single quotes.

This is primarily to be able to copy printed commands
and run them in a shell.

BEFORE:

```python
>>> from sh import ls
>>> print(ls.bake('How I Met Your Mother'))
/bin/ls How I Met Your Mother
```

AFTER:

```python
>>> print(ls.bake('How I Met Your Mother'))
/bin/ls 'How I Met Your Mother'
```
@amoffat
Copy link
Owner

amoffat commented May 9, 2025

Cool, thanks for the contribution. It may take a little while for it to land in the main branch, as I have some maintenance tasks to do before then.

@amoffat amoffat merged commit ea434f0 into amoffat:develop May 9, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants