task

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2021 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Tasks = make(map[string]*Task)

Tasks is our global task name to *Task map.

Functions

This section is empty.

Types

type Task

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

Task is a named container for steps.

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) Env

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

Env sets environment variables.

func (*Task) Exec

func (g *Task) Exec(args ...string) *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) 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) 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.

Jump to

Keyboard shortcuts

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