T
Task4w ago
snowe

Does precondition support go templates?

It seems that preconditions don't support the templates, or if they do, I'm unable to figure it out.
3 Replies
snowe
snoweOP4w ago
not sure why discord isn't showing my post text... I said "It seems that preconditions don't support the templates, or if they do, I'm unable to figure it out" I would expect this to work:
version: '3'

tasks:
default:
cmds:
- echo "{{.CLI_ARGS}}"
preconditions:
- {{eq .CLI_ARGS "hi there"}}
version: '3'

tasks:
default:
cmds:
- echo "{{.CLI_ARGS}}"
preconditions:
- {{eq .CLI_ARGS "hi there"}}
but I get the error:
❯ task
err: cannot unmarshal !!map into string
file: /Users/.../Taskfile.yml:8:9
6 | - echo "{{.CLI_ARGS}}"
7 | preconditions:
❯ task
err: cannot unmarshal !!map into string
file: /Users/.../Taskfile.yml:8:9
6 | - echo "{{.CLI_ARGS}}"
7 | preconditions:
andreynering
andreynering4w ago
Hi @snowe, This is an YAML parse error. You need to wrap your precondition into quotes.
snowe
snoweOP4w ago
I had tried that and it fails the same. wait. nope didn't change the right file 🤦🏽‍♂️ ok, that did work. thank you. had to use single quote.
Want results from more Discord servers?
Add your server