task

package module
v3.19.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2022 License: MIT Imports: 34 Imported by: 11

README

Task

Task is a task runner / build tool that aims to be simpler and easier to use than, for example, GNU Make.

Installation | Documentation | Twitter | Discord

Gold Sponsors

Documentation

Index

Constants

View Source
const (
	// MaximumTaskCall is the max number of times a task can be called.
	// This exists to prevent infinite loops on cyclic dependencies
	MaximumTaskCall = 100
)

Variables

View Source
var (
	// ErrPreconditionFailed is returned when a precondition fails
	ErrPreconditionFailed = errors.New("task: precondition not met")
)
View Source
var (
	// ErrTaskfileAlreadyExists is returned on creating a Taskfile if one already exists
	ErrTaskfileAlreadyExists = errors.New("task: A Taskfile already exists")
)

Functions

func InitTaskfile

func InitTaskfile(w io.Writer, dir string) error

InitTaskfile Taskfile creates a new Taskfile

Types

type Executor

type Executor struct {
	Taskfile *taskfile.Taskfile

	Dir         string
	TempDir     string
	Entrypoint  string
	Force       bool
	Watch       bool
	Verbose     bool
	Silent      bool
	Dry         bool
	Summary     bool
	Parallel    bool
	Color       bool
	Concurrency int
	Interval    string

	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer

	Logger      *logger.Logger
	Compiler    compiler.Compiler
	Output      output.Output
	OutputStyle taskfile.Output
	// contains filtered or unexported fields
}

Executor executes a Taskfile

func (*Executor) CompiledTask

func (e *Executor) CompiledTask(call taskfile.Call) (*taskfile.Task, error)

CompiledTask returns a copy of a task, but replacing variables in almost all properties using the Go template package.

func (*Executor) FastCompiledTask added in v3.2.2

func (e *Executor) FastCompiledTask(call taskfile.Call) (*taskfile.Task, error)

FastCompiledTask is like CompiledTask, but it skippes dynamic variables.

func (*Executor) GetHash added in v3.7.0

func (e *Executor) GetHash(t *taskfile.Task) (string, error)

func (*Executor) GetTask added in v3.17.0

func (e *Executor) GetTask(call taskfile.Call) (*taskfile.Task, error)

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) []*taskfile.Task

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

func (e *Executor) ListTaskNames(allTasks bool)

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(filters ...FilterFunc) bool

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 or not tasks were found.

func (*Executor) Run

func (e *Executor) Run(ctx context.Context, calls ...taskfile.Call) error

Run runs Task

func (*Executor) RunTask

func (e *Executor) RunTask(ctx context.Context, call taskfile.Call) error

RunTask runs a task by its name

func (*Executor) Setup

func (e *Executor) Setup() error

func (*Executor) Status

func (e *Executor) Status(ctx context.Context, calls ...taskfile.Call) error

Status returns an error if any the of given tasks is not up-to-date

type FilterFunc added in v3.18.0

type FilterFunc func(tasks []*taskfile.Task) []*taskfile.Task

func Filter added in v3.18.0

func Filter(f func(task *taskfile.Task) bool) FilterFunc

Filter is a generic task filtering function. It will remove each task in the slice where the result of the given function is true.

func FilterOutInternal added in v3.18.0

func FilterOutInternal() FilterFunc

FilterOutInternal removes all tasks that are marked as internal.

func FilterOutNoDesc added in v3.18.0

func FilterOutNoDesc() FilterFunc

FilterOutNoDesc removes all tasks that do not contain a description.

type MaximumTaskCallExceededError

type MaximumTaskCallExceededError struct {
	// contains filtered or unexported fields
}

MaximumTaskCallExceededError is returned when a task is called too many times. In this case you probably have a cyclic dependendy or infinite loop

func (*MaximumTaskCallExceededError) Error

type TaskRunError added in v3.13.0

type TaskRunError struct {
	// contains filtered or unexported fields
}

func (*TaskRunError) Error added in v3.13.0

func (err *TaskRunError) Error() string

func (*TaskRunError) ExitCode added in v3.13.0

func (err *TaskRunError) ExitCode() int

Directories

Path Synopsis
cmd
sleepit command
task command
internal
sleepit command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL