Skip to content

Conversation

@bolinfest
Copy link
Collaborator

@bolinfest bolinfest commented May 30, 2025

The way these definitions worked before, they did not handle quoted args with spaces properly.

For example, if you had /tmp/test-just/printlen.py as:

#!/usr/bin/env python3

import sys

print(len(sys.argv))

and your justfile was:

printlen *args:
    /tmp/test-just/printlen.py {{args}}

Then:

$ just printlen foo bar
3
$ just printlen 'foo bar'
3

which is not what we want: 'foo bar' should be treated as one argument.

The fix is to use positional-arguments:

set positional-arguments

printlen *args:
    /tmp/test-just/printlen.py "$@"

@bolinfest bolinfest changed the base branch from main to pr1167 May 30, 2025 16:06
@bolinfest bolinfest changed the base branch from pr1167 to main May 30, 2025 16:06
@bolinfest bolinfest merged commit a0239c3 into main May 30, 2025
10 checks passed
@bolinfest bolinfest deleted the pr1169 branch May 30, 2025 16:11
@github-actions github-actions bot locked and limited conversation to collaborators May 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants