1
0
mirror of https://github.com/go-task/task.git synced 2025-11-23 22:24:45 +02:00

add silent mode to disable echoing of commands

This commit is contained in:
Andrey Nering
2017-07-19 20:20:24 -03:00
parent dc6cb68327
commit d0b37df615
5 changed files with 82 additions and 8 deletions

View File

@@ -31,6 +31,7 @@ type Executor struct {
Force bool
Watch bool
Verbose bool
Silent bool
Stdin io.Reader
Stdout io.Writer
@@ -60,6 +61,7 @@ type Task struct {
Vars Vars
Set string
Env Vars
Silent bool
}
// Run runs Task
@@ -194,7 +196,9 @@ func (e *Executor) runCommand(ctx context.Context, t *Task, call Call, i int) er
Stderr: e.Stderr,
}
e.println(cmd.Cmd)
if !cmd.Silent && !t.Silent && !e.Silent {
e.println(cmd.Cmd)
}
if t.Set != "" {
var stdout bytes.Buffer
opts.Stdout = &stdout