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

Passing arguments for python different than node? I needed to add -- #2246

Closed
kenbankspeng opened this issue Jul 14, 2024 · 4 comments
Closed

Comments

@kenbankspeng
Copy link

Using python via justfile, this works:

switch *args:
    python "$PYTHON_SCRIPTS/switch/switch.py" {{ args }}

Using node on zsh prompt, passing #123456 as argument, this works:

node "$NODE_SCRIPTS/color/color.mjs" #123456

Using node via justfile, this does NOT work, even though just says it runs the same as above.

color *args:
  node "$NODE_SCRIPTS/color/color.mjs"  {{ args }}

Using node via justfile, this DOES work:

color *args:
  node "$NODE_SCRIPTS/color/color.mjs" -- {{ args }}

Is this expected?

@kenbankspeng
Copy link
Author

Hmmm, since my node arguments are -c #123456, maybe the parsing is ambiguous since my option -c #123456 could be for node or for my color script and -- disambiguates it.

Yet I don't have the ambiguity on the command line, just through just. <-- ambiguous pun?

Maybe I would have the ambiguity on python too if my args were options like -c.

@laniakea64
Copy link
Contributor

Using node on zsh prompt, passing #123456 as argument,

Does your justfile set the shell to zsh?

From https://just.systems/man/en/chapter_27.html#shell -

The default shell is sh -cu.

And in sh, an unquoted #123456 would be treated as a shell comment, so it wouldn't be passed as an argument.

Without knowing the specific Python script and NodeJS script you're using, no idea what else might be causing the differences.

@casey
Copy link
Owner

casey commented Jul 14, 2024

I would be very surprised if this was caused by just. Please feel free to reopen if so!

@casey casey closed this as completed Jul 14, 2024
@kenbankspeng
Copy link
Author

@laniakea64 thank you.

Just FYI. The unquoted #123456 was indeed the issue. My shell seems fine. set shell := ['zsh', '-cu'], and #123456 is fine as an argument in zsh.

But I suspect that in its processing journey it is treated as a comment somehow.
"{{ args }}" doesn't work since it combines the two args as a single arg.

Wrapping the second argument with double quotes within justfile works:
color one two:
node "$NODE_SCRIPTS/color/color.mjs" {{ one }} "{{ two }}"

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

No branches or pull requests

3 participants