go-task / task

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

arbitrarily override `silent: true` on the root of the taskfile. #1455

Open osher opened 8 months ago

osher commented 8 months ago

Lets first distinct between two users:

True, in many cases they are the same, but the bigger the team/org the higher the probability that they are not. As such they have different expectations.

User Usecase 1

As automation user I don't want to see the internals, I just want the job done. For this - the automation engineers should provide silent: true in the root of the taskfiles.

User Usecase 2

As automation user I want an option to see "under the hood" so I can gain trust on the system or consider destructive commands before I run them

:no_entry: In this case, --dry does not work on levels where silent: true is used If that's on the root - then it's all levels, and --dry does nothing and yields no output.

Automation Engineer Usecase 1

As an automation engineer I want to be able to reverse this setting arbitrarily as I run locally in task development / troubleshoot, so that I can ask to see what's under the hood without changing codes.

Automation Engineer Usecase 2

As an automation engineer When I run with --dry I expect silent: true to be overridden with silent: false and be propagated down to all levels. So that I can debug my project without gotchas

:no_entry: In this case, --dry does not work on levels where silent: true is applied

Automation Engineer Usecase 3

As an automation engineer I would like to control silent mode using environment variables So that I don't have to provide --silent: false every time. e.g. TASK_SILENT_MODE

Proposed Logic

I propose that when --silent to be stronger than TASK_SILENT_MODE. So that the precedence should be, from weakest to strongest

  1. TASK_SILENT_MODE
  2. taskfile:silent
  3. taskfile:task.silent
  4. taskfile:task.cmds[*].silent
  5. -s/--silent / -S/--no-silent
  6. --dry-run - implies an overpowering silent:false
FourteenBrush commented 5 months ago

It would indeed be useful to override a silent: true at the root with a silent: false on a task level.

mattrussell-sonocent commented 3 months ago

It would indeed be useful to override a silent: true at the root with a silent: false on a task level.

+1 - I was confused that this didn't take precedence.