docs example for `preconditions` doesn't work as written
See: https://github.com/go-task/task/blob/b681ef98689fa0bd004413ccf462765b33b15b32/docs/docs/api_reference.md?plain=1#L351
The docs uses precondition which, in testing, is ignored by Task.
Example Taskfile:
version: '3'
tasks:
broken:
precondition: test -f nonexistent
cmds:
- "echo 'precondition met, wtf'"
works:
preconditions:
- test -f nonexistent
cmds:
- "echo 'precondition met, wtf'"
oneliner:
preconditions: [ test -f nonexistent ]
cmds:
- "echo 'precondition met, wtf'"
The broken task matches what the docs show, and it will always run. The works and oneliner tasks won't run unless you create a file named nonexistent.
I have only tested this on 3.25.0, but looking at the code it appears that preconditions is the correct property.
Same thing happens here.
Seems like a documentation error (with the "tip"). Preconditions are defined as a list, and implemented as such.
Yes, preconditions are a list. The doc is now up to date