task
task copied to clipboard
{{.TASK}} remains in task listing
Versions
- Task version: v3.14.0
- Operating System: Mac OS X 10.15.7
Example Taskfile showing the issue
version: '3'
tasks:
DoesNotWork:
desc: DoesNotWork
label: '{{.TASK}}'
cmds:
- echo "PARAM = '{{ .PARAM | trim }}'"
DoesWork:
desc: DoesWork
label: '{{.TASK}}'
cmds:
- echo "PARAM = '{{ .PARAM | default "" | trim }}'"
Run:
$ task -l
task: Available tasks for this project:
* {{.TASK}}: DoesNotWork
* DoesWork: DoesWork
Notes:
- Both tasks are intended to be called from the command-line but also embedded within other tasks by passing their task name as variable
TASK. - The task
DoesNotWorkfails if run without the parameter (which is expected):
The task$ task DoesNotWork template: :1:27: executing "" at <trim>: invalid value; expected stringDoesWorkwould work due to the provided default.
However, this should not affect the output of task -l. Or is this a hidden feature to validate the correctness of tasks? Like: If it looks like {{.TASK}}, some default is missing.
Hi @MarioSchwalbe, thanks for reporting this bug.
IIRC templating is skipped completely for --list.
We already have a more lightweight variation of the function that does templating (which is faster because it skips shell commands from running). We could consider doing that for this use case as well.
It seems that this is not a problem anymore on the current release.
I'm closing this. If anyone continue to experience this issue, let me know.