Documentation
¶
Index ¶
- Constants
- Variables
- func Completion(shell string) (string, error)
- func FilterOutInternal(task *ast.Task) bool
- func FilterOutNoDesc(task *ast.Task) bool
- func InitTaskfile(path string) (string, error)
- func ShouldIgnore(path string) bool
- func WithAssumeTerm(assumeTerm bool) *assumeTermOption
- func WithAssumeYes(assumeYes bool) *assumeYesOption
- func WithCACert(caCert string) *caCertOption
- func WithCacheExpiryDuration(duration time.Duration) *cacheExpiryDurationOption
- func WithCert(cert string) *certOption
- func WithCertKey(certKey string) *certKeyOption
- func WithColor(color bool) *colorOption
- func WithConcurrency(concurrency int) *concurrencyOption
- func WithDir(dir string) *dirOption
- func WithDisableFuzzy(disableFuzzy bool) *disableFuzzyOption
- func WithDownload(download bool) *downloadOption
- func WithDry(dry bool) *dryOption
- func WithEntrypoint(entrypoint string) *entrypointOption
- func WithFailfast(failfast bool) *failfastOption
- func WithForce(force bool) *forceOption
- func WithForceAll(forceAll bool) *forceAllOption
- func WithIO(rw io.ReadWriter) *ioOption
- func WithInsecure(insecure bool) *insecureOption
- func WithInteractive(interactive bool) *interactiveOption
- func WithInterval(interval time.Duration) *intervalOption
- func WithOffline(offline bool) *offlineOption
- func WithOutputStyle(outputStyle ast.Output) *outputStyleOption
- func WithParallel(parallel bool) *parallelOption
- func WithRemoteCacheDir(dir string) *remoteCacheDirOption
- func WithSilent(silent bool) *silentOption
- func WithStderr(stderr io.Writer) *stderrOption
- func WithStdin(stdin io.Reader) *stdinOption
- func WithStdout(stdout io.Writer) *stdoutOption
- func WithSummary(summary bool) *summaryOption
- func WithTaskSorter(sorter sort.Sorter) *taskSorterOption
- func WithTempDir(tempDir TempDir) *tempDirOption
- func WithTempDirPath(path string) *tempDirPathOption
- func WithTimeout(timeout time.Duration) *timeoutOption
- func WithTrustedHosts(trustedHosts []string) *trustedHostsOption
- func WithVerbose(verbose bool) *verboseOption
- func WithVersionCheck(enableVersionCheck bool) *versionCheckOption
- func WithWatch(watch bool) *watchOption
- type Call
- type Compiler
- func (c *Compiler) FastGetVariables(t *ast.Task, call *Call) (*ast.Vars, error)
- func (c *Compiler) GetTaskfileVariables() (*ast.Vars, error)
- func (c *Compiler) GetVariables(t *ast.Task, call *Call) (*ast.Vars, error)
- func (c *Compiler) HandleDynamicVar(v ast.Var, dir string, e []string) (string, error)
- func (c *Compiler) ResetCache()
- type Executor
- func (e *Executor) CompiledTask(call *Call) (*ast.Task, error)
- func (e *Executor) CompiledTaskForTaskList(call *Call) (*ast.Task, error)
- func (e *Executor) FastCompiledTask(call *Call) (*ast.Task, error)
- func (e *Executor) FindMatchingTasks(call *Call) ([]*MatchingTask, error)
- func (e *Executor) GetHash(t *ast.Task) (string, error)
- func (e *Executor) GetTask(call *Call) (*ast.Task, error)
- func (e *Executor) GetTaskList(filters ...FilterFunc) ([]*ast.Task, error)
- func (e *Executor) InterceptInterruptSignals()
- func (e *Executor) ListTaskNames(allTasks bool) error
- func (e *Executor) ListTasks(o ListOptions) (bool, error)
- func (e *Executor) Options(opts ...ExecutorOption)
- func (e *Executor) Run(ctx context.Context, calls ...*Call) error
- func (e *Executor) RunTask(ctx context.Context, call *Call) error
- func (e *Executor) Setup() error
- func (e *Executor) Status(ctx context.Context, calls ...*Call) error
- func (e *Executor) ToEditorOutput(tasks []*ast.Task, noStatus bool, nested bool) (*editors.Namespace, error)
- type ExecutorOption
- type FilterFunc
- type ListOptions
- type MatchingTask
- type TempDir
Constants ¶
const ( // MaximumTaskCall is the max number of times a task can be called. // This exists to prevent infinite loops on cyclic dependencies MaximumTaskCall = 1000 )
Variables ¶
var DefaultTaskfile string
var ErrPreconditionFailed = errors.New("task: precondition not met")
ErrPreconditionFailed is returned when a precondition fails
Functions ¶
func Completion ¶ added in v3.39.0
func FilterOutInternal ¶ added in v3.18.0
FilterOutInternal removes all tasks that are marked as internal.
func FilterOutNoDesc ¶ added in v3.18.0
FilterOutNoDesc removes all tasks that do not contain a description.
func InitTaskfile ¶
InitTaskfile creates a new Taskfile at path.
path can be either a file path or a directory path. If path is a directory, path/Taskfile.yml will be created.
The final file path is always returned and may be different from the input path.
func ShouldIgnore ¶ added in v3.44.0
func WithAssumeTerm ¶ added in v3.43.0
func WithAssumeTerm(assumeTerm bool) *assumeTermOption
WithAssumeTerm is used for testing purposes to simulate a terminal.
func WithAssumeYes ¶ added in v3.43.0
func WithAssumeYes(assumeYes bool) *assumeYesOption
WithAssumeYes tells the Executor to assume "yes" for all prompts.
func WithCACert ¶ added in v3.48.0
func WithCACert(caCert string) *caCertOption
WithCACert sets the path to a custom CA certificate for TLS connections.
func WithCacheExpiryDuration ¶ added in v3.43.0
WithCacheExpiryDuration sets the duration after which the cache is considered expired. By default, the cache is 0 (disabled).
func WithCert ¶ added in v3.48.0
func WithCert(cert string) *certOption
WithCert sets the path to a client certificate for TLS connections.
func WithCertKey ¶ added in v3.48.0
func WithCertKey(certKey string) *certKeyOption
WithCertKey sets the path to a client certificate key for TLS connections.
func WithColor ¶ added in v3.43.0
func WithColor(color bool) *colorOption
WithColor tells the Executor whether or not to output using colorized strings.
func WithConcurrency ¶ added in v3.43.0
func WithConcurrency(concurrency int) *concurrencyOption
WithConcurrency sets the maximum number of tasks that the Executor can run in parallel.
func WithDir ¶ added in v3.43.0
func WithDir(dir string) *dirOption
WithDir sets the working directory of the Executor. By default, the directory is set to the user's current working directory.
func WithDisableFuzzy ¶ added in v3.46.0
func WithDisableFuzzy(disableFuzzy bool) *disableFuzzyOption
WithDisableFuzzy tells the Executor to disable fuzzy matching for task names.
func WithDownload ¶ added in v3.43.0
func WithDownload(download bool) *downloadOption
WithDownload forces the Executor to download a fresh copy of the taskfile from the remote source.
func WithDry ¶ added in v3.43.0
func WithDry(dry bool) *dryOption
WithDry tells the Executor to output the commands that would be run without actually running them.
func WithEntrypoint ¶ added in v3.43.0
func WithEntrypoint(entrypoint string) *entrypointOption
WithEntrypoint sets the entrypoint (main Taskfile) of the Executor. By default, Task will search for one of the default Taskfiles in the given directory.
func WithFailfast ¶ added in v3.46.0
func WithFailfast(failfast bool) *failfastOption
WithFailfast tells the Executor to stop running tasks as soon as any task returns an error.
func WithForce ¶ added in v3.43.0
func WithForce(force bool) *forceOption
WithForce ensures that the Executor always runs a task, even when fingerprinting or prompts would normally stop it.
func WithForceAll ¶ added in v3.43.0
func WithForceAll(forceAll bool) *forceAllOption
WithForceAll ensures that the Executor always runs all tasks (including subtasks), even when fingerprinting or prompts would normally stop them.
func WithIO ¶ added in v3.43.0
func WithIO(rw io.ReadWriter) *ioOption
WithIO sets the Executor's standard input, output, and error to the same io.ReadWriter.
func WithInsecure ¶ added in v3.43.0
func WithInsecure(insecure bool) *insecureOption
WithInsecure allows the Executor to make insecure connections when reading remote taskfiles. By default, insecure connections are rejected.
func WithInteractive ¶ added in v3.47.0
func WithInteractive(interactive bool) *interactiveOption
WithInteractive tells the Executor to prompt for missing required variables.
func WithInterval ¶ added in v3.43.0
WithInterval sets the interval at which the Executor will wait for duplicated events before running a task.
func WithOffline ¶ added in v3.43.0
func WithOffline(offline bool) *offlineOption
WithOffline stops the Executor from being able to make network connections. It will still be able to read local files and cached copies of remote files.
func WithOutputStyle ¶ added in v3.43.0
WithOutputStyle sets the output style of the Executor. By default, the output style is set to the style defined in the Taskfile.
func WithParallel ¶ added in v3.43.0
func WithParallel(parallel bool) *parallelOption
WithParallel tells the Executor to run tasks given in the same call in parallel.
func WithRemoteCacheDir ¶ added in v3.46.0
func WithRemoteCacheDir(dir string) *remoteCacheDirOption
WithRemoteCacheDir sets the directory where remote taskfiles are cached.
func WithSilent ¶ added in v3.43.0
func WithSilent(silent bool) *silentOption
WithSilent tells the Executor to suppress all output except for the output of the tasks that are run.
func WithStderr ¶ added in v3.43.0
func WithStdout ¶ added in v3.43.0
func WithSummary ¶ added in v3.43.0
func WithSummary(summary bool) *summaryOption
WithSummary tells the Executor to output a summary of the given tasks instead of running them.
func WithTaskSorter ¶ added in v3.43.0
WithTaskSorter sets the sorter that the Executor will use to sort tasks. By default, the sorter is set to sort tasks alphabetically, but with tasks with no namespace (in the root Taskfile) first.
func WithTempDir ¶ added in v3.43.0
func WithTempDir(tempDir TempDir) *tempDirOption
WithTempDir sets the temporary directory that will be used by Executor for storing temporary files like checksums and cached remote files. By default, the temporary directory is set to the user's temporary directory.
func WithTempDirPath ¶ added in v3.52.0
func WithTempDirPath(path string) *tempDirPathOption
WithTempDirPath sets an unresolved path used to build Executor.TempDir during Executor.Setup. Relative paths are resolved from the root Taskfile directory. Use WithTempDir when the remote and fingerprint directories have already been resolved.
func WithTimeout ¶ added in v3.43.0
WithTimeout sets the Executor's timeout for fetching remote taskfiles. By default, the timeout is set to 10 seconds.
func WithTrustedHosts ¶ added in v3.46.0
func WithTrustedHosts(trustedHosts []string) *trustedHostsOption
WithTrustedHosts configures the Executor with a list of trusted hosts for remote Taskfiles. Hosts in this list will not prompt for user confirmation.
func WithVerbose ¶ added in v3.43.0
func WithVerbose(verbose bool) *verboseOption
WithVerbose tells the Executor to output more information about the tasks that are run.
func WithVersionCheck ¶ added in v3.43.0
func WithVersionCheck(enableVersionCheck bool) *versionCheckOption
WithVersionCheck tells the Executor whether or not to check the schema version of the Taskfile before running.
Types ¶
type Call ¶ added in v3.42.0
type Call struct {
Task string
Vars *ast.Vars
Silent bool
Indirect bool // True if the task was called by another task
}
Call is the parameters to a task call
type Compiler ¶ added in v3.42.0
type Compiler struct {
Dir string
Entrypoint string
UserWorkingDir string
TaskfileEnv *ast.Vars
TaskfileVars *ast.Vars
Logger *logger.Logger
// contains filtered or unexported fields
}
func (*Compiler) FastGetVariables ¶ added in v3.42.0
func (*Compiler) GetTaskfileVariables ¶ added in v3.42.0
func (*Compiler) GetVariables ¶ added in v3.42.0
func (*Compiler) HandleDynamicVar ¶ added in v3.42.0
func (*Compiler) ResetCache ¶ added in v3.42.0
func (c *Compiler) ResetCache()
ResetCache clear the dynamic variables cache
type Executor ¶
type Executor struct {
// Flags
Dir string
Entrypoint string
TempDir TempDir
TempDirPath string
Force bool
ForceAll bool
Insecure bool
Download bool
Offline bool
TrustedHosts []string
RemoteHeaders taskfile.HeadersByHost
Timeout time.Duration
CacheExpiryDuration time.Duration
RemoteCacheDir string
CACert string
Cert string
CertKey string
Watch bool
Verbose bool
Silent bool
DisableFuzzy bool
AssumeYes bool
AssumeTerm bool // Used for testing
Interactive bool
Dry bool
Summary bool
Parallel bool
Color bool
Concurrency int
Interval time.Duration
Failfast bool
// I/O
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
// Internal
Taskfile *ast.Taskfile
Logger *logger.Logger
Compiler *Compiler
Output output.Output
OutputStyle ast.Output
TaskSorter sort.Sorter
UserWorkingDir string
EnableVersionCheck bool
// contains filtered or unexported fields
}
An Executor is used for processing Taskfile(s) and executing the task(s) within them.
func NewExecutor ¶ added in v3.43.0
func NewExecutor(opts ...ExecutorOption) *Executor
NewExecutor creates a new Executor and applies the given functional options to it.
func (*Executor) CompiledTask ¶
CompiledTask returns a copy of a task, but replacing variables in almost all properties using the Go template package.
func (*Executor) CompiledTaskForTaskList ¶ added in v3.45.5
func (*Executor) FastCompiledTask ¶ added in v3.2.2
FastCompiledTask is like CompiledTask, but it skippes dynamic variables.
func (*Executor) FindMatchingTasks ¶ added in v3.42.0
func (e *Executor) FindMatchingTasks(call *Call) ([]*MatchingTask, error)
FindMatchingTasks returns a list of tasks that match the given call. A task matches a call if its name is equal to the call's task name, or one of aliases, or if it matches a wildcard pattern. The function returns a list of MatchingTask structs, each containing a task and a list of wildcards that were matched. If multiple tasks match due to aliases, a TaskNameConflictError is returned.
func (*Executor) GetTask ¶ added in v3.17.0
GetTask will return the task with the name matching the given call from the taskfile. If no task is found, it will search for tasks with a matching alias. If multiple tasks contain the same alias or no matches are found an error is returned.
func (*Executor) GetTaskList ¶ added in v3.18.0
func (e *Executor) GetTaskList(filters ...FilterFunc) ([]*ast.Task, error)
func (*Executor) InterceptInterruptSignals ¶ added in v3.13.0
func (e *Executor) InterceptInterruptSignals()
NOTE(@andreynering): This function intercepts SIGINT and SIGTERM signals so the Task process is not killed immediately and processes running have time to do cleanup work.
func (*Executor) ListTaskNames ¶ added in v3.12.0
ListTaskNames prints only the task names in a Taskfile. Only tasks with a non-empty description are printed if allTasks is false. Otherwise, all task names are printed.
func (*Executor) ListTasks ¶ added in v3.18.0
func (e *Executor) ListTasks(o ListOptions) (bool, error)
ListTasks prints a list of tasks. Tasks that match the given filters will be excluded from the list. The function returns a boolean indicating whether tasks were found and an error if one was encountered while preparing the output.
func (*Executor) Options ¶ added in v3.43.0
func (e *Executor) Options(opts ...ExecutorOption)
Options loops through the given ExecutorOption functions and applies them to the Executor.
type ExecutorOption ¶ added in v3.43.0
type ExecutorOption interface {
ApplyToExecutor(*Executor)
}
An ExecutorOption is any type that can apply a configuration to an Executor.
func WithRemoteHeaders ¶ added in v3.54.0
func WithRemoteHeaders(remoteHeaders taskfile.HeadersByHost) ExecutorOption
WithRemoteHeaders configures the Executor with the HTTP headers to send when fetching a remote Taskfile, keyed by host.
type FilterFunc ¶ added in v3.18.0
type ListOptions ¶ added in v3.19.1
type ListOptions struct {
ListOnlyTasksWithDescriptions bool
ListAllTasks bool
FormatTaskListAsJSON bool
NoStatus bool
Nested bool
}
ListOptions collects list-related options
func NewListOptions ¶ added in v3.19.1
func NewListOptions(list, listAll, listAsJson, noStatus, nested bool) ListOptions
NewListOptions creates a new ListOptions instance
func (ListOptions) Filters ¶ added in v3.19.1
func (o ListOptions) Filters() []FilterFunc
Filters returns the slice of FilterFunc which filters a list of ast.Task according to the given ListOptions
func (ListOptions) ShouldListTasks ¶ added in v3.19.1
func (o ListOptions) ShouldListTasks() bool
ShouldListTasks returns true if one of the options to list tasks has been set to true
type MatchingTask ¶ added in v3.42.0
MatchingTask represents a task that matches a given call. It includes the task itself and a list of wildcards that were matched.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
release
command
|
|
|
sleepit
command
|
|
|
task
command
|
|
|
internal
|
|
|
complete
Package complete implements the `task __complete` protocol consumed by the shell wrappers.
|
Package complete implements the `task __complete` protocol consumed by the shell wrappers. |
|
gitignore
Package gitignore implements gitignore pattern matching.
|
Package gitignore implements gitignore pattern matching. |
|
refs
Package refs resolves the `ref` fields of a Taskfile into concrete values.
|
Package refs resolves the `ref` fields of a Taskfile into concrete values. |