casey / just

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

Can a recipe know if it has been invoked directly or as a depedency of another? #1930

Open nogweii opened 3 months ago

nogweii commented 3 months ago

Per the question, if not, I think it would be a useful function to add.

For what I'm thinking, I'd like to do the following:

run: install
  ./start_server.py

install:
  poetry install {{ if is_dep() { '--quiet' } else { '--verbose' } }}

That is, if someone were to run just install manually, they'd get the full output from poetry install. If a user runs just run instead, poetry would have reduced output.

casey commented 3 months ago

This isn't currently possible, but seems pretty reasonable to me. I think the implementation would be pretty simple, in case anyone wants to take a crack at it.

laniakea64 commented 3 months ago

In the mean time, here's a possible workaround? -

run: (install '--quiet')
  ./start_server.py

install flag='--verbose':
  poetry install {{ flag }}