Skip to content

Option to disable output of commands in summary #2261

@br-arruda

Description

@br-arruda

Description

Hi, I read the issue #1350 and PR #1656. You have chosen summary to output multi-line description of a task, along with the commands inside the task.

My use case is to document tasks which have parameters. Currently --summary produces way more output than I wish it was exposed to someone trying to understand (or to remember) how to use my taskfiles.

For example, I have this field:

  terragrunt_apply:
    desc: |
      Executes the terraform apply command.

      CI: executes terraform in non-interactive way. Default: false
      PLAN: executes terraform plan before apply. Default: false

Which renders this way with task --list:

$ task
task: Available tasks for this project:
* terragrunt_apply:         Executes the terraform apply command.  CI: executes terraform in non-interactive way. Default: false PLAN: executes terraform plan before apply. Default: false 

--list is interesting because it list all tasks, but it collapses multi-line. --summary respect multi-line, but it only works one command at a time, and I can't control its output to only show the summary field's content, it will show also the task commands.

I tried to manipulate --list output, adding \n to the text inside description field and throwing the result inside printf, something like this:

tasks:
  default:
    cmds:
      - printf "$(task --list | sed 's/\\n/\\n\\t/g')"

Which produced:

* terragrunt_apply:         Executes the terraform apply command.
          CI: executes terraform in non-interactive way. Default: false
         PLAN: executes terraform plan before apply. Default: false

But I don't want to go this path, I would rather rely on task to make this.. So can you help this use case?

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: formattingChanges related to output and formatting.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions