go-task / task

A task runner / simpler Make alternative written in Go
https://taskfile.dev
MIT License
11.34k stars 609 forks source link

silent on defer #1877

Open danilobuerger opened 1 week ago

danilobuerger commented 1 week ago

Currently it doesn't seem possible to set silent on defers:

      - defer: echo "hello world"
        silent: true
      - defer:
          cmd: echo "hello world"
          silent: true

both dont work.

trulede commented 6 days ago

For a cmd, it seems that is not parsed from the YAML. https://github.com/go-task/task/blob/c4f708b222cf49a55fe3e62404d06026539af18b/taskfile/ast/cmd.go#L82 compare with line 68.

If you add "Silent bool" to "deferredCmd" and the necessary assignment (as per line 68) ... it might work.

Same again if you would use a defer task. Currently not parsed, but if you add it, might work. See line 91, here it is probably already parsed (its in type Call) but just not assigned.