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

add --list (or -l) flag to print existing tasks

If an inexixtent task is given, the help also prints as before

Also fixing README documentation

Closes #51
This commit is contained in:
Andrey Nering
2017-07-15 14:09:27 -03:00
parent e781ac2512
commit 998935ea55
4 changed files with 16 additions and 7 deletions

View File

@@ -6,7 +6,8 @@ import (
"text/tabwriter"
)
func (e *Executor) printExistingTasksHelp() {
// PrintTasksHelp prints help os tasks that have a description
func (e *Executor) PrintTasksHelp() {
tasks := e.tasksWithDesc()
if len(tasks) == 0 {
return
@@ -16,7 +17,7 @@ func (e *Executor) printExistingTasksHelp() {
// Format in tab-separated columns with a tab stop of 8.
w := tabwriter.NewWriter(e.Stdout, 0, 8, 0, '\t', 0)
for _, task := range tasks {
fmt.Fprintln(w, fmt.Sprintf("- %s:\t%s", task, e.Tasks[task].Desc))
fmt.Fprintln(w, fmt.Sprintf("* %s:\t%s", task, e.Tasks[task].Desc))
}
w.Flush()
}