From 834babe0efd19e68512af53b635fb8ee9e5ca848 Mon Sep 17 00:00:00 2001 From: Andrey Nering Date: Wed, 15 Nov 2023 22:38:53 -0300 Subject: [PATCH] chore: add changelog + improve code for #1368 --- CHANGELOG.md | 2 ++ help.go | 79 +++++++++++++++++++++++----------------------------- 2 files changed, 37 insertions(+), 44 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aab67745..3410ef61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ - Fix bug where dynamic `vars:` and `env:` were being executed when they should actually be skipped by `platforms:` (#1273, #1377 by @andreynering). - Fix `schema.json` to make `silent` valid in `cmds` that use `for` (#1385, #1386 by @iainvm). +- Add new `--no-status` flag to skip expensive status checks when running + `task --list --json` (#1348, #1368 by @amancevice). ## v3.31.0 - 2023-10-07 diff --git a/help.go b/help.go index 05f1e151..7f4d3a91 100644 --- a/help.go +++ b/help.go @@ -168,51 +168,42 @@ func (e *Executor) ToEditorOutput(tasks []*taskfile.Task, noStatus bool) (*edito for i := range tasks { task := tasks[i] j := i - if noStatus { - g.Go(func() error { - o.Tasks[j] = editors.Task{ - Name: task.Name(), - Desc: task.Desc, - Summary: task.Summary, - UpToDate: false, - Location: &editors.Location{ - Line: task.Location.Line, - Column: task.Location.Column, - Taskfile: task.Location.Taskfile, - }, - } + g.Go(func() error { + o.Tasks[j] = editors.Task{ + Name: task.Name(), + Desc: task.Desc, + Summary: task.Summary, + UpToDate: false, + Location: &editors.Location{ + Line: task.Location.Line, + Column: task.Location.Column, + Taskfile: task.Location.Taskfile, + }, + } + + if noStatus { return nil - }) - } else { - g.Go(func() error { - // Get the fingerprinting method to use - method := e.Taskfile.Method - if task.Method != "" { - method = task.Method - } - upToDate, err := fingerprint.IsTaskUpToDate(context.Background(), task, - fingerprint.WithMethod(method), - fingerprint.WithTempDir(e.TempDir), - fingerprint.WithDry(e.Dry), - fingerprint.WithLogger(e.Logger), - ) - if err != nil { - return err - } - o.Tasks[j] = editors.Task{ - Name: task.Name(), - Desc: task.Desc, - Summary: task.Summary, - UpToDate: upToDate, - Location: &editors.Location{ - Line: task.Location.Line, - Column: task.Location.Column, - Taskfile: task.Location.Taskfile, - }, - } - return nil - }) - } + } + + // Get the fingerprinting method to use + method := e.Taskfile.Method + if task.Method != "" { + method = task.Method + } + upToDate, err := fingerprint.IsTaskUpToDate(context.Background(), task, + fingerprint.WithMethod(method), + fingerprint.WithTempDir(e.TempDir), + fingerprint.WithDry(e.Dry), + fingerprint.WithLogger(e.Logger), + ) + if err != nil { + return err + } + + o.Tasks[j].UpToDate = upToDate + + return nil + }) } return o, g.Wait() }