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:
5
help.go
5
help.go
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user