1
0
mirror of https://github.com/go-task/task.git synced 2025-02-09 13:47:06 +02:00

output detailed task description

This commit is contained in:
jaedle 2019-02-24 09:24:57 +01:00
parent 13614fb3c4
commit 07221a1b20
3 changed files with 18 additions and 1 deletions

View File

@ -17,6 +17,10 @@ tasks:
install:
desc: Installs Task
details: |
Push Docker image to Google cloud registry.
The env variable "DOCKER_IMAGE_FQN" define the Docker image name to push.
cmds:
- go install -v -ldflags="-w -s -X main.version={{.GIT_COMMIT}}" ./cmd/task
env:

View File

@ -1,6 +1,6 @@
package taskfile
// Tasks representas a group of tasks
// Tasks represents a group of tasks
type Tasks map[string]*Task
// Task represents a task
@ -9,6 +9,7 @@ type Task struct {
Cmds []*Cmd
Deps []*Dep
Desc string
Details string
Sources []string
Generates []string
Status []string

12
task.go
View File

@ -63,6 +63,18 @@ func (e *Executor) Run(ctx context.Context, calls ...taskfile.Call) error {
}
}
if e.Details {
task := calls[0].Task
if e.Taskfile.Tasks[task].Details == "" {
e.Logger.Errf("task: There is no detailed description for task: %s", task)
return nil
}
e.Logger.Outf(e.Taskfile.Tasks[task].Details)
return nil
}
if e.Watch {
return e.watchTasks(calls...)
}