-
Notifications
You must be signed in to change notification settings - Fork 499
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
Running recipes from parent directories when there's no recipe with the same name in the current directory #1036
Comments
My initial reaction is that a module system is the way to support this. See #383 and #929. I can imagine an implementation that would use the first recipe to inform how just searches for the justfile, but I'm not sure if that would favorably compare to a module system. A module system is a huge new feature, but maybe it could be scoped down to the point where the initial implementation isn't too bad, and it supports this use-case. There's also the |
Since you consider module system to be huge, and since a rudimentary form of inheritance works right now, I wonder if #761 (pardon the possibly rude repetition) might fit? I'd be happy to tackle the actual work btw. |
I think the first version of the module system could be really simple. Start in the current directory, and as you go up to the justfile, every time you see a file called "mod.just", add that to a list. Then, when you get to the justfile, parse the justfile, and all the modules in the list. Then, start looking in the justfiles one by one, starting with the deepest going upwards. When you find a justfile with the recipe, use that justfile. |
Yeah, that's actually pretty easy to mentally model. |
There are some tricky things to consider here. One example is, if the recipe isn't in the current justfile, and you search up for another justfile, and you find another justfile but there's a parse error, do you display that error? I started implementing this, but hit some of these tricky things and stopped working on it. I think now I should have just finished it, and put it behind the |
I do agree that this is a bit tricky, but I would assume that yes, you just display that error. I guess another question is whether |
First of all, this would be a killer feature @casey @soenkehahn. Some of the solutions that come to mind:
Other things that come to mind:
|
Thanks so much. I was on a road trip of sorts for the first half of the year so couldn't chime in, but the one man army that you are, clearly that didn't matter :-) |
When my current directory does not contain a
justfile
but a parent directory does,just
looks for recipes in thejustfile
in that parent dir. This allows me to e.g. place ajustfile
in the root of a monorepo and have its recipes available everywhere.However, this does not work when my current directory contains a
justfile
, even if thatjustfile
does not contain the recipe I want to run. Here's an example:I would've expected this to work, as long as my local
justfile
doesn't shadow the recipe that's higher up. Is there a good reason why this shouldn't work?The text was updated successfully, but these errors were encountered: