Skip to content

Conversation

@trulede
Copy link
Contributor

@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
Contributor 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)?

@trulede trulede closed this Apr 28, 2025
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