task

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Tasks []*Task

Tasks is our global task name to *Task map.

Functions

func AddTask added in v0.2.0

func AddTask(t *Task)

AddTask adds a task by its name. If a task with the same name already exists, it is replaced.

Types

type Task

type Task struct {
	Name string
	// contains filtered or unexported fields
}

Task is a named container for steps.

func GetTask added in v0.2.0

func GetTask(name string) *Task

GetTask returns the Task matching the provided name.

func NewTask

func NewTask(name string, context steps.Context) *Task

NewTask returns a pointer to a Task with required properties initialized.

func (*Task) Catch

func (g *Task) Catch(f func(error) error) *Task

Catch catches the error of any preceding steps.

func (*Task) Chdir

func (g *Task) Chdir(path string) *Task

Chdir changes the current directory.

func (*Task) End added in v0.3.0

func (g *Task) End() *Task

End signifies the end of a prompt.

func (*Task) Env

func (g *Task) Env(args ...string) *Task

Env sets environment variables.

func (*Task) Exec

func (g *Task) Exec(args ...interface{}) *Task

Exec executes a command.

func (*Task) Execute

func (g *Task) Execute() chan steps.Result

Execute runs the given Task.

func (*Task) Exists

func (g *Task) Exists(path string) *Task

Exists checks if the given file or directory exists.

func (*Task) No added in v0.3.0

func (g *Task) No() *Task

No signifies the start of steps for a no prompt result.

func (*Task) Parallel added in v0.2.0

func (g *Task) Parallel(taskNames ...string) *Task

Parallel runs tasks in parallel.

func (*Task) Print added in v0.3.0

func (g *Task) Print(args ...interface{}) *Task

Print prints either the args passed or the previous task's result.

func (*Task) Prompt added in v0.3.0

func (g *Task) Prompt(v string) *Task

Prompt prompts (Y/N) using the passed value or the result of the previous task.

func (*Task) Result

func (g *Task) Result(f func(interface{})) *Task

Result receives an interface to the result of the last step.

func (*Task) Run

func (g *Task) Run(taskName string) *Task

Run runs a task with the given name.

func (*Task) Signaler added in v0.2.0

func (g *Task) Signaler(t ...os.Signal) *Task

Signaler redirects a given signal to kill steps in the task.

func (*Task) Sleep

func (g *Task) Sleep(duration string) *Task

Sleep delays time by the given string, adhering to https://pkg.go.dev/time#ParseDuration

func (*Task) Watch

func (g *Task) Watch(paths ...string) *Task

Watch sets up a variadic number of glob paths to watch. It supports double-star "**" globbing.

func (*Task) Yes added in v0.3.0

func (g *Task) Yes() *Task

Yes signifies the start of steps for a yes prompt result.

Jump to

Keyboard shortcuts

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