1
0
mirror of https://github.com/go-task/task.git synced 2025-06-15 00:15:10 +02:00

Add --json flag to be used by editor extensions (#936)

This commit is contained in:
David Alpert
2022-12-17 07:31:00 -06:00
committed by GitHub
parent 41a9316523
commit 321f7b59d8
5 changed files with 131 additions and 24 deletions

View File

@ -72,12 +72,10 @@ func (e *Executor) Run(ctx context.Context, calls ...taskfile.Call) error {
for _, call := range calls {
task, err := e.GetTask(call)
if err != nil {
e.ListTasks(FilterOutInternal(), FilterOutNoDesc())
return err
}
if task.Internal {
e.ListTasks(FilterOutInternal(), FilterOutNoDesc())
return &taskInternalError{taskName: call.Task}
}
}
@ -396,7 +394,7 @@ func (e *Executor) GetTaskList(filters ...FilterFunc) []*taskfile.Task {
tasks = filter(tasks)
}
// Sort the tasks
// Sort the tasks.
// Tasks that are not namespaced should be listed before tasks that are.
// We detect this by searching for a ':' in the task name.
sort.Slice(tasks, func(i, j int) bool {