1
0
mirror of https://github.com/go-task/task.git synced 2025-03-17 21:08:01 +02:00

fix: list tasks (#1520)

This commit is contained in:
Pete Davison 2024-02-28 16:44:34 -06:00 committed by GitHub
parent 330722335d
commit 6c21568447
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 14 deletions

View File

@ -264,10 +264,6 @@ func run() error {
return err
}
if (listOptions.ShouldListTasks()) && flags.silent {
return e.ListTaskNames(flags.listAll)
}
if err := e.Setup(); err != nil {
return err
}
@ -278,6 +274,10 @@ func run() error {
return nil
}
if (listOptions.ShouldListTasks()) && flags.silent {
return e.ListTaskNames(flags.listAll)
}
if listOptions.ShouldListTasks() {
foundTasks, err := e.ListTasks(listOptions)
if err != nil {

10
help.go
View File

@ -121,16 +121,6 @@ func (e *Executor) ListTasks(o ListOptions) (bool, error) {
// Only tasks with a non-empty description are printed if allTasks is false.
// Otherwise, all task names are printed.
func (e *Executor) ListTaskNames(allTasks bool) error {
// if called from cmd/task.go, e.Logger has not yet been initialized
if e.Logger == nil {
e.setupLogger()
}
// if called from cmd/task.go, e.Taskfile has not yet been parsed
if e.Taskfile == nil {
if err := e.readTaskfile(); err != nil {
return err
}
}
// use stdout if no output defined
var w io.Writer = os.Stdout
if e.Stdout != nil {