task icon indicating copy to clipboard operation
task copied to clipboard

Prefix --summary output by task description if description and summary available

Open ypid-work opened this issue 2 years ago • 1 comments

task --summary build should probably include the short task description if available. The example given in the docs also highlights this need. What description would that build task have? Probably "Release your project to github" that was included in the summary. But then we have redundantly. I see the following options:

1. Add special variable "DESC" to be used in summary (😄 for voting)

Would be most flexible and allow something like this:

tasks:
  release:
    # deps: [build]
    desc: Release your project to github
    summary: |
      {{ .DESC }}

      It will build your project before starting the release.
      Please make sure that you have set GITHUB_TOKEN before starting.
    cmds:
      - your-release-tool

2. --summary first prints description than summary (🎉 for voting)

~~3. Add include_desc_in_summary option into Taskfile schema~~

Edit: After thinking about it, I don’t like this option anymore.

Add to https://taskfile.dev/api/#taskfile-schema

Less flexible. Should probably default to true.

~~4. special variable "DESC" from 1 and include_desc_in_summary from 3~~

Edit: After thinking about it, I don’t like this option anymore.

5. --summary first prints description than summary except when .DESC is used in summary (❤️ for voting)

Combines options 1. and 2.

Implementation idea: Try to render the template without providing DESC to the template engine. If it renders fine, summary should be prefixed by .DESC in go code. Otherwise, rerender with DESC provided to the template engine.

ypid-work avatar Sep 14 '23 17:09 ypid-work

Is there any update on this? How many votes would be needed for a decision?

libre-man avatar Sep 10 '24 14:09 libre-man