Skip to content

Show vars, requires when calling task --summary #2486

@deepbrook

Description

@deepbrook

Description

I want taskfile to automatically show the vars and requires when calling taskfile --summary <task>, so that I do not have to manually document them.


Given the following:

> cat Taskfile.yaml
version: 3

tasks:
  mytask:
    desc: It does things
    summary: |
      It does things and has optional and required variables.
    vars:
      OPTIONAL_VAR: "hello"
    requires:
      vars:
        - REQUIRED_VAR
    cmds:
      - cmd: echo {{ .OPTIONAL_VAR }} {{ .REQUIRED_VAR }}

Current behaviour

> task --summary mytask
task: infrastructure:mytask

It does things and has optional and required variables.

commands:
 - echo hello

Desired behaviour

task: infrastructure:mytask

It does things and has optional and required variables.

vars:
  OPTIONAL_VAR: "hello"

requires:
  vars:
    - REQUIRED_VAR

commands:
 - echo hello

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