From 023a902f614876a655e0e6dea127379eef028748 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sindre=20R=C3=B8kenes=20Myren?= Date: Mon, 3 Jul 2017 14:58:09 +0200 Subject: [PATCH 1/2] Improve task command help text --- cmd/task/task.go | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/cmd/task/task.go b/cmd/task/task.go index 48e95efe..969cb956 100644 --- a/cmd/task/task.go +++ b/cmd/task/task.go @@ -14,14 +14,14 @@ var ( version = "master" ) -func main() { - log.SetFlags(0) +const usage = `Usage: task [-ifw] [--init] [--force] [--watch] [task...] - pflag.Usage = func() { - fmt.Println(`task [target1 target2 ...]: Runs commands under targets like make. +Runs the specified task(s). Falls back to the "default" task if no task name +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: cmds: @@ -30,7 +30,13 @@ hello: generates: - output.txt ''' -`) +` + +func main() { + log.SetFlags(0) + + pflag.Usage = func() { + fmt.Println(usage) pflag.PrintDefaults() } From 2ace0defd04bc2eb4b49fb251b93a5f6e350b475 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sindre=20R=C3=B8kenes=20Myren?= Date: Mon, 3 Jul 2017 14:59:06 +0200 Subject: [PATCH 2/2] Print command, also when "set:" is specified Always prints the command, even when the set-keyword is used within the task. --- task.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/task.go b/task.go index cc69bdfe..07378958 100644 --- a/task.go +++ b/task.go @@ -249,8 +249,8 @@ func (e *Executor) runCommand(ctx context.Context, task string, i int) error { Stderr: e.Stderr, } + e.println(c) if t.Set == "" { - e.println(c) opts.Stdout = e.Stdout if err = execext.RunCommand(opts); err != nil { return err