just icon indicating copy to clipboard operation
just copied to clipboard

Reading justfiles from stdin

Open gl-yziquel opened this issue 1 year ago • 5 comments

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.

gl-yziquel avatar Jun 29 '24 10:06 gl-yziquel

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

laniakea64 avatar Jun 29 '24 14:06 laniakea64

@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.

gl-yziquel avatar Jun 29 '24 15:06 gl-yziquel

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

laniakea64 avatar Jun 29 '24 15:06 laniakea64

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.

gl-yziquel avatar Jun 29 '24 19:06 gl-yziquel

/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.

casey avatar Jun 29 '24 19:06 casey