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

Change merge order of CLI special args to allow correct templating of taskfile global vars. #2095

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

trulede
Copy link

@trulede trulede commented Mar 1, 2025

fixes #2090

This places CLI special args before taskfile global vars.

The tricky thing here is that e.Taskfile.Vars is used earlier to setup the e.Compiler object (TaskfileVars). Therefore, both pointers need to be assigned to the new Vars object, otherwise the compiler will operate from the previous list.

@trulede
Copy link
Author

trulede commented Mar 1, 2025

As a side note, I would solve the problem by adding a c.SpecialVars and the placing the processing between TaskfileEnv and TaskfileVars at the following location:

for k, v := range c.TaskfileVars.All() {

    for k, v := range c.SpecialVars.All() {
		if err := rangeFunc(k, v); err != nil {
			return nil, err
		}
	}

but I think there are bigger plans in a different direction (#2036)?

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

Successfully merging this pull request may close these issues.

Global vars can't use .CLI_ARGS special var as default value
1 participant