diff --git a/CHANGELOG.md b/CHANGELOG.md index 080632c6..5d431d49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## Unreleased + +- Add `--json` flag (alias `-j`) with the intent to improve support for code + editors and add room to other possible integrations. This is basic for now, + but we plan to add more info in the near future + ([#936](https://github.com/go-task/task/pull/936) by @davidalpert, [#764](https://github.com/go-task/task/issues/764)). + ## v3.19.0 - 2022-12-05 - Installation via npm now supports [pnpm](https://pnpm.io/) as well diff --git a/help.go b/help.go index b9b57aee..15a51fed 100644 --- a/help.go +++ b/help.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" "fmt" - "github.com/go-task/task/v3/taskfile" "io" "log" "os" @@ -14,6 +13,7 @@ import ( "github.com/go-task/task/v3/internal/editors" "github.com/go-task/task/v3/internal/logger" + "github.com/go-task/task/v3/taskfile" ) // ListOptions collects list-related options diff --git a/task.go b/task.go index 7c7822d5..22508eda 100644 --- a/task.go +++ b/task.go @@ -72,10 +72,20 @@ func (e *Executor) Run(ctx context.Context, calls ...taskfile.Call) error { for _, call := range calls { task, err := e.GetTask(call) if err != nil { + if _, ok := err.(*taskNotFoundError); ok { + if _, err := e.ListTasks(ListOptions{ListOnlyTasksWithDescriptions: true}); err != nil { + return err + } + } return err } if task.Internal { + if _, ok := err.(*taskNotFoundError); ok { + if _, err := e.ListTasks(ListOptions{ListOnlyTasksWithDescriptions: true}); err != nil { + return err + } + } return &taskInternalError{taskName: call.Task} } } diff --git a/task_test.go b/task_test.go index b6dd72a9..e5abad13 100644 --- a/task_test.go +++ b/task_test.go @@ -1040,7 +1040,7 @@ func TestIncludesInternal(t *testing.T) { }{ {"included internal task via task", "task-1", false, "Hello, World!\n"}, {"included internal task via dep", "task-2", false, "Hello, World!\n"}, - {"included internal direct", "included:task-3", true, ""}, + {"included internal direct", "included:task-3", true, "task: No tasks with description available. Try --list-all to list all tasks\n"}, } for _, test := range tests {