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

Using multiple justfiles / default include user-just file #1025

Open
kaihowl opened this issue Nov 13, 2021 · 4 comments
Open

Using multiple justfiles / default include user-just file #1025

kaihowl opened this issue Nov 13, 2021 · 4 comments

Comments

@kaihowl
Copy link

kaihowl commented Nov 13, 2021

Hi,

I was thinking of the following use case: Let's consider I have project specific justfiles that invoke the right build / test commands for the project in the directory in which they are placed. But there are a few cross-project commands that are useful to have in every project, e.g., applying clang-format. These won't change between different projects.

Instead of copying them into every justfile, I'd much rather put them in a user-level justfile. From the README.adoc I thought I could just place them in the ~/.user.justfile and have them available next to all other recipes from the local justfile. This is not the case as far as I can tell from experimentation. Next I tried supplying multiple -f parameters. This is also not allowed.

I understand that including multiple justfiles makes conflict resolution of recipe names necessary. It also invites other corner cases and might be overall undesirable. I tried searching for past discussions on the issue tracker but was not very lucky to find relevant ones.

Therefore, I decided to create this issue to get an understanding of what is already possible and what can be considered future improvements, for which you are willing to accept PRs.

Thank you so much for such a well-maintained project. :)

@casey
Copy link
Owner

casey commented Nov 13, 2021

Thank you for the kind words! Thank you for using just 🙇‍♂️

I think this probably depends on adding some kind of module system, which is tracked in #383. You'd want to have a module system, import the user-level justfile in your justfile, and then call recipes from the user-level justfile.

@kaihowl
Copy link
Author

kaihowl commented Nov 24, 2021

I understand. That ticket probably makes more sense in the long run.

Since I admittedly only skimmed #383, please let me know if the following is addressed there already and I have to give the ticket a more detailed read:

Would allowing multiple -f parameters with the semantic of concatenating all recipes be acceptable? In case of recipe conflicts, the invocation would outright fail and not continue.

If this is not an acceptable idea for reasons that I overlooked, please feel free to close this ticket in favor of #383.

@casey
Copy link
Owner

casey commented Nov 24, 2021

It's not that it should be closed in favor of #383, it's that it depends on #383. The best way to implement this feature is to first add a module system, and then use that module system to combine the justfile in the invocation directory with the justfile in .user.justfile.

@jpbochi
Copy link
Contributor

jpbochi commented Aug 4, 2022

FWIW, the need for this feature is reduced by the existence of this: https://just.systems/man/en/chapter_51.html#invoking-justfiles-in-other-directories

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants