1
0
mirror of https://github.com/go-task/task.git synced 2025-06-08 23:56:21 +02:00

Merge pull request #35 from smyrman/print-on-set

Print on set
This commit is contained in:
Andrey Nering 2017-07-03 19:53:03 -03:00 committed by GitHub
commit a3bfa13670
2 changed files with 14 additions and 8 deletions

View File

@ -14,14 +14,14 @@ var (
version = "master" version = "master"
) )
func main() { const usage = `Usage: task [-ifw] [--init] [--force] [--watch] [task...]
log.SetFlags(0)
pflag.Usage = func() { Runs the specified task(s). Falls back to the "default" task if no task name
fmt.Println(`task [target1 target2 ...]: Runs commands under targets like make. was specified, or lists all tasks if an unknown task name was specified.
Example: 'task hello' with the following 'Taskfile.yml' file will generate an
'output.txt' file with the content "hello".
Example: 'task hello' with the following 'Taskfile.yml' file will generate
an 'output.txt' file.
''' '''
hello: hello:
cmds: cmds:
@ -30,7 +30,13 @@ hello:
generates: generates:
- output.txt - output.txt
''' '''
`) `
func main() {
log.SetFlags(0)
pflag.Usage = func() {
fmt.Println(usage)
pflag.PrintDefaults() pflag.PrintDefaults()
} }

View File

@ -249,8 +249,8 @@ func (e *Executor) runCommand(ctx context.Context, task string, i int) error {
Stderr: e.Stderr, Stderr: e.Stderr,
} }
if t.Set == "" {
e.println(c) e.println(c)
if t.Set == "" {
opts.Stdout = e.Stdout opts.Stdout = e.Stdout
if err = execext.RunCommand(opts); err != nil { if err = execext.RunCommand(opts); err != nil {
return err return err