casey / just

🤖 Just a command runner
https://just.systems
Creative Commons Zero v1.0 Universal
20.54k stars 454 forks source link

Reading justfiles from stdin #2206

Open gl-yziquel opened 3 months ago

gl-yziquel commented 3 months ago

Hi.

As I'd like to declare just fragments remotely and get them executed locally, I'd like to be able to fetch them via curl and get them piped into just. Doesn't seem to currently be possible.

Something like just --sdtin would be nice.

laniakea64 commented 3 months ago

It is possible:

$ echo 'foo:
>   echo foo
> 
> bar:
>   echo bar' | just -f /dev/stdin
echo foo
foo

But note that this method uses /dev as working directory:

$ echo 'a:
>   pwd' | just -f /dev/stdin
pwd
/dev

There is https://github.com/casey/just/pull/1933 for adding proper support

gl-yziquel commented 3 months ago

@laniakea64 I thought about this. Unfortunately, I really do not like the idea of having the folder switched to /dev when using /dev/stdin as a Justfile...

For now, I worked around it with a temporary file. But I also do not like it at all.

laniakea64 commented 3 months ago

I really do not like the idea of having the folder switched to /dev when using /dev/stdin as a Justfile...

Yeah, me neither. Although there is also this option as a workaround:

$ echo 'a:
>   pwd' | just -d . -f /dev/stdin
gl-yziquel commented 3 months ago

I really do not like the idea of having the folder switched to /dev when using /dev/stdin as a Justfile...

Yeah, me neither. Although there is also this option as a workaround:

$ echo 'a:
>   pwd' | just -d . -f /dev/stdin

Pretty cool.

casey commented 3 months ago

/dev/stdin is a great workaround, but it doesn't work on Windows, and it should probably be easier, so I'm going to reopen this.

1933 is currently open to implement this.