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

Bug: when recipe repeats recipe inside it, it only runs the first time #1985

Open
whyboris opened this issue Mar 29, 2024 · 3 comments
Open

Comments

@whyboris
Copy link

Example justfile:

lol: hi hello hi

@hi:
  echo "1"

@hello:
  echo "2"

Expected output from just lol

1
2
1

Actual output from just lol

1
2

I think this is a bug because I had a command that did cleanup between various other commands and I spent 2 hours trying to figure out why cleanup wasn't working 😢

@casey
Copy link
Owner

casey commented Mar 29, 2024

This is actually as intended, although I can see why it would be confusing. Just will only run normal recipes once, even if they appear more than once on the command line, or more than once in recipe dependencies. Just also doesn't necessarily run recipes in the same order as they're passed on the command line. If you do just a b, and a is a dependency of b, it will run b first and then a.

@casey casey closed this as completed Mar 29, 2024
@whyboris
Copy link
Author

I suggest adding a quick note in the relevant section:

https://github.com/casey/just?tab=readme-ov-file#features

You can also use dependencies to run multiple recipes by default:

_Note:_ just will not run a recipe twice

The model I had in my head was "recipe", meaning a step-by-step instruction of what just will do. I'm puzzled why anyone would expect just to ignore an instruction.

I am not insisting on implementing changes - I super ❤️ love just ❤️ -- I just think that even though my use case is unusual, there may be others who will have cleanup steps in their script.

My example: https://github.com/whyboris/utilitarianism.net/blob/main/justfile
I build a website in three steps: search, PDF, and production - so I had to duplicate a cleanup step :trollface:

@casey
Copy link
Owner

casey commented Mar 29, 2024

I think that's reasonable, I'll reopen this issue to track adding a note to the docs.

@casey casey reopened this Mar 29, 2024
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

2 participants