Task: Add help informations for a task

Created on 23 Mar 2018  路  11Comments  路  Source: go-task/task

Request

Ability to add help informations for a task.

Example

version: "2"

tasks:
  "gcloud:docker:push":
    desc: Push Docker image to Google cloud registry
    help: |
        Push Docker image to Google cloud registry.

        The env variable "DOCKER_IMAGE_FQN" define the Docker image name to push.
    silent: true
    cmds:
    - cmd: gcloud docker -- push {{.DOCKER_IMAGE_FQN}}
$ task -l
task: Available tasks for this project:
* gcloud:docker:push:   Push Docker image to Google cloud registry
$ task help gcloud:docker:push

Push Docker image to Google cloud registry.

The env variable "DOCKER_IMAGE_FQN" define the Docker image name to push

Finally

What do you think ?

feature good first issue

Most helpful comment

I think we can overwrite it then, but if given without any other argument, the behavior should be the same as today

Or, if someone have a better flag name ideia other than --help, I'm open to suggestions, but I couldn't think in any

All 11 comments

Hi @skurtzemann! Thanks for the feature request.

I think this proposal makes sense. Since this would be easy to implement, I'll keep this open for potential contributors.

Simplest case: use cobra to add support for the help subcommand.

What do you think, @andreynering?

@skurtzemann I think I'd prefer to keep using pflag as the cli library

I think this should work the same as -l/--list flag, so beside it being a flag, it will work like a command:

task --help my:task:name

I'm not sure pflag allow overwrite the --help flag, though. Otherwise, we'd have to use pflag.Usage instead

-h/--help can be overridden with pflag. See: L1002, L949.

Do we use another flag instead?

I think we can overwrite it then, but if given without any other argument, the behavior should be the same as today

Or, if someone have a better flag name ideia other than --help, I'm open to suggestions, but I couldn't think in any

I think sticking with -h and --help and the semantics that @andreynering suggests sounds like a good suggestion UX wise.

Look for a PR later today. (-0400 GMT.)

Unexpected nephew-sitting is going to push this to tomorrow. The mental work is complete, so the translation to code will be pushed in the morning.

This one look like a good contribution for the first time touching the codebase :)
I would prefer a --details or --info flag for the task because of the collision with --help.

Is it fine if I start going with-details?

WIP Pull Request #180

Should be done? 馃槉

Merging since this is now implemented on master

See: https://taskfile.dev/#/usage?id=display-summary-of-task

Was this page helpful?
0 / 5 - 0 ratings

Related issues

craighurley picture craighurley  路  3Comments

soullivaneuh picture soullivaneuh  路  3Comments

InsaneRaph picture InsaneRaph  路  3Comments

ronlut picture ronlut  路  7Comments

conejo picture conejo  路  3Comments