Open aXe1 opened 2 months ago
If set some variable with shell, and override it with task parameter, then task will in some cases use one parameter and in some - another.
Taskfile.yml
version: 3 env: SOME_PATH: '{{if not (empty .PATH_PART)}}/some/path/{{.PATH_PART}}/file.txt{{else}}{{fail "PATH_PART not set!"}}{{end}}' tasks: default: cmds: - echo _${PATH_PART}_ - echo _{{.PATH_PART}}_ - echo _${SOME_PATH}_ - echo _{{.SOME_PATH}}_
Bug reproduce steps:
$ PATH_PART=foo task PATH_PART=bar task: [default] echo _${PATH_PART}_ _foo_ task: [default] echo _bar_ _bar_ task: [default] echo _${SOME_PATH}_ _/some/path/bar/file.txt_ task: [default] echo _/some/path/foo/file.txt_ _/some/path/foo/file.txt_ $ task PATH_PART=bar template: :1:73: executing "" at <fail "PATH_PART not set!">: error calling fail: PATH_PART not set! $ PATH_PART=foo task task: [default] echo _${PATH_PART}_ _foo_ task: [default] echo _foo_ _foo_ task: [default] echo _${SOME_PATH}_ _/some/path/foo/file.txt_ task: [default] echo _/some/path/foo/file.txt_ _/some/path/foo/file.txt_
Take a look at https://taskfile.dev/experiments/env-precedence
If set some variable with shell, and override it with task parameter, then task will in some cases use one parameter and in some - another.
Taskfile.yml
Bug reproduce steps: