1
0
mirror of https://github.com/go-task/task.git synced 2025-11-25 22:32:55 +02:00

refactor: executor functional options (#2085)

* refactor: executor functional options

* refactor: minor tidy up of list code

* fix: WithVersionCheck missing from call to NewExecutor

* feat: docstrings for structs with functional options

* refactor: prefix the functional options with the name of the struct they belong to
This commit is contained in:
Pete Davison
2025-03-10 20:38:25 +00:00
committed by GitHub
parent 8181352d54
commit ffeb3bcc3f
10 changed files with 1023 additions and 724 deletions

55
task.go
View File

@@ -3,13 +3,10 @@ package task
import (
"context"
"fmt"
"io"
"os"
"runtime"
"slices"
"sync"
"sync/atomic"
"time"
"github.com/go-task/task/v3/errors"
"github.com/go-task/task/v3/internal/env"
@@ -23,7 +20,6 @@ import (
"github.com/go-task/task/v3/internal/templater"
"github.com/go-task/task/v3/taskfile/ast"
"github.com/sajari/fuzzy"
"golang.org/x/sync/errgroup"
"mvdan.cc/sh/v3/interp"
)
@@ -34,57 +30,6 @@ const (
MaximumTaskCall = 1000
)
type TempDir struct {
Remote string
Fingerprint string
}
// Executor executes a Taskfile
type Executor struct {
Taskfile *ast.Taskfile
Dir string
Entrypoint string
TempDir TempDir
Force bool
ForceAll bool
Insecure bool
Download bool
Offline bool
Timeout time.Duration
Watch bool
Verbose bool
Silent bool
AssumeYes bool
AssumeTerm bool // Used for testing
Dry bool
Summary bool
Parallel bool
Color bool
Concurrency int
Interval time.Duration
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
Logger *logger.Logger
Compiler *Compiler
Output output.Output
OutputStyle ast.Output
TaskSorter sort.Sorter
UserWorkingDir string
EnableVersionCheck bool
fuzzyModel *fuzzy.Model
concurrencySemaphore chan struct{}
taskCallCount map[string]*int32
mkdirMutexMap map[string]*sync.Mutex
executionHashes map[string]context.Context
executionHashesMutex sync.Mutex
}
// MatchingTask represents a task that matches a given call. It includes the
// task itself and a list of wildcards that were matched.
type MatchingTask struct {