-
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
Sharing just
arguments between invocations
#1829
Comments
+1 to this approach and it'd be consistent with existing behavior. In the case of |
Oh I didn't know about |
I think that some combination of environment variables, and a setting, might be a good approach here. Automatically exporting and inheriting arguments would break backwards compatibility, so a setting would be necessary so that users can opt-in on a per-justfile basis. For example, if users used So, if something like This setting can be initially made unstable, so that we can tweak which settings are exported. I suspect that there might be some tricky edge cases. I think that something like |
I labeled this as a good first issue, in case anyone wants to take a crack at it. |
I'm starting to take a look at this and I have a question: should the setting be "global" |
👍 Nice idea. +1 for the precise proposal. This syntax is intrinsically backwards-compatible with future additions to exported/exportable arguments, and it provides more functionality for justfile authors. I think naming the setting |
I like the idea of explicitly specifying what you want to export. There's already a |
An idea that might dovetail with this: Add a function where Then I can recurse with recurse:
{{ just() }} recurse while ensuring that
Having written this out, I realize it sounds a lot like |
That's another option but it has a problem: in a CI environment, it's easier to It's the same for local use too, I would like to be able to set |
Although that could be useful, it is not a good "alternative" to environment variables. In addition to what @poliorcetics said, it would be harder for recipes to use the options for something other than passing to recursive |
Another possible approach: Export all variables to a single Provide a function In
Edit: We can also export each variable to different variables, like |
In a previous version
--command-color
was added to allow coloring the command that is run in the stdout output. This works well but it not transferred to inner calls tojust
:Looking at the manual, this is not something that is easily done right now. It can also cause problems with
--yes
: top level recipes will be automatically confirmed but not inner onesI see at leastfour possible solutions:
JUST_CONFIRM="yes"
orJUST_COMMAND_COLOR="red"
which would be automatically readJUST_EXTRA_ARGS="--yes --command-color red"
which would be automatically readjust just_args() something ...
in the recipe aboveset inherit-just-args := true
I'm unsure which is the best. The env vars solutions will make it easy to share arguments, for example in CI scripts but could be surprising (maybe a log at the start, saying "using ... from env" ?). It's already something done by lots of programs though, so I don't think that's too bad.
Solutions 3 and 4 have the issue that they need to be set in each Justfile to work, which will be frustrating when adding a new one in a subdirectory for example. Solution 3 especially needs to be set on each invocation, which is quite invasive but offers lots of control.
The text was updated successfully, but these errors were encountered: