1
0
mirror of https://github.com/go-task/task.git synced 2025-04-17 12:06:30 +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: install:
desc: Installs Task 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: cmds:
- go install -v -ldflags="-w -s -X main.version={{.GIT_COMMIT}}" ./cmd/task - go install -v -ldflags="-w -s -X main.version={{.GIT_COMMIT}}" ./cmd/task
env: env:

View File

@ -1,6 +1,6 @@
package taskfile package taskfile
// Tasks representas a group of tasks // Tasks represents a group of tasks
type Tasks map[string]*Task type Tasks map[string]*Task
// Task represents a task // Task represents a task
@ -9,6 +9,7 @@ type Task struct {
Cmds []*Cmd Cmds []*Cmd
Deps []*Dep Deps []*Dep
Desc string Desc string
Details string
Sources []string Sources []string
Generates []string Generates []string
Status []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 { if e.Watch {
return e.watchTasks(calls...) return e.watchTasks(calls...)
} }