-
Notifications
You must be signed in to change notification settings - Fork 503
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
Add an option to [working-directory: <path>] create the directory if it's missing #2510
Comments
Thanks for the issue! Can you describe the use case a little bit? It's a bit of a niche feature, so I want to make sure there isn't a better workaround. |
Sure, for example, I want to create/update some kind of "project", so I use the attribute to configure the correct folder. |
Gotcha! Something that would be a little more general would be if it were possible to use variables in attributes, so you could do this:
So you could avoid the deduplication. Another idea is giving child recipes access to the parent recipe working directory:
But, actually, that would require re-running recipes even if their arguments haven't changed, because they're being called by different recipes with different working directories, so that's probably no good. Another idea is creating a variable that's usable in dependencies which refers to the current working directory:
But that's also kind of weird. I think probably allowing variables in attributes is the best, most general solution to avoid dupllication. A |
Closing in favor of #2521, since that fixes this for all attributes. |
Sorry to "re-open" this issue... I know that the same issue has already been discussed on Issue #2293, but if possible, add an opt-in flag to the
working-directory
attribute to create the directory if it's missing.As @casey said, the issue is that it would mask typos, i.e., the working directory does exist, but you misspelled it in the justfile, just would create it and continue instead of erroring.
But if you create an opt-in feature, it could be enabled in some specific cases to avoid some trouble.
Currently, I have some recipes that needed a specific directory, but in the first run, it wouldn't exist.
One way that I found to "bypass" this problem is by creating another task that create the directories, like the following:
But the problem is that the path is duplicated, so I think that it's more error-prone.
If that's not possible or desirable, please disregard this issue.
Thanks in advance.
The text was updated successfully, but these errors were encountered: