-
-
Notifications
You must be signed in to change notification settings - Fork 656
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
Global vars can't use .CLI_ARGS special var as default value #2090
Comments
Some of the special vars are set here: Line 199 in b9d202c
and the CLI args are set here, I think after the task has been compiled, which means they are not available to any previous global vars which have already been resolved (i.e. this issue): Line 220 in b9d202c
EDIT: |
This call loads the global vars: Line 169 in b9d202c
Then this one adds the CLI special vars: Line 225 in b9d202c
since they are after the global vars, they will not be resolved by the templating (since that is ordered). Conversely, the other special vars are loaded by the compiler here: Line 49 in b9d202c
these go in after the env vars, but before the global vars ... so those work. Solution would be to either; relocate the CLI special vars to getSpecialVars() (which might be tricky), or to change the order that the CLI special vars are merged into e.Taskfile.Vars.Merge(globals, nil). I think the former is the better solution, if it could be achieved. |
Description
I wanted to use a global
vars:
key to default to the .CLI_ARGS special var.And then use it in a task, so both of these examples work:
The above behavior works if
vars:
is used directly in the task definition:Only when using
vars:
globally.CLI_ARGS
comes empty and doesn't work.Version
v3.41.0 (h1:giUddhe0XZLbEWIQ/MuTPipR9ek+teulIA5xf/2IHXg=)
Operating system
macOS Sequioa 15.3.1 (24D70)
Experiments Enabled
No response
Example Taskfile
The text was updated successfully, but these errors were encountered: