just icon indicating copy to clipboard operation
just copied to clipboard

When using `[positional-arguments]`, "$@" is not expanded in a command's echo

Open halloleo opened this issue 4 months ago • 2 comments

Say I have a task

[positional-arguments]
run *args:
    scala-cli run . -- "$@"

When i run this task with

just run --myflag myarg

I get the output

scala-cli run . -- "$@" ...

However it would be more helpful to have echoed the real positional arguments I had provide, i.e.:

scala-cli run . -- --myflag myarg ...

halloleo avatar Sep 03 '25 02:09 halloleo

I agree that echoing positional arguments would be helpful and I too would like this for some of my justfile recipes, but what would be the best way to present positional arguments?

Expanding "$@" is probably not the solution. The echoed command is printed by just itself. In just the shell is not necessarily a Bourne-like shell, it could be any scripting language, so just doesn't have any way to be sure what "$@" or other positional argument specifiers are supposed to expand to (if anything) or what is the correct way to insert/quote each argument for the shell's language.

If there is a good way to add echoing of positional arguments while keeping recipe lines echoed as they are now, then +1 from me.

laniakea64 avatar Sep 03 '25 15:09 laniakea64

Thanks for chiming in, @laniakea64.

Expanding "$@" is probably not the solution. The echoed command is printed by just itself.

Just obviously has the arguments in some internal representation. I assume it is a list of strings. It could plainly print this list, could it not?

halloleo avatar Sep 04 '25 03:09 halloleo