tasks

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewExecuteCommandTask

func NewExecuteCommandTask(name string, arg ...string) func() error

NewExecuteCommandTask is a convenience method for creating a task that executes a command

func NewMakeDirectoryTask

func NewMakeDirectoryTask(dir string) func() error

NewMakeDirectoryTask is a convenience method for creating a task that creates a directory if it doesn't exist

func PathExists

func PathExists(path string) bool

PathExists returns true or false if the path exists

Types

type Runner

type Runner struct {
	Name   string
	Tasks  []*Task
	Groups []*Runner
}

Runner collects tasks to run

func NewRunner

func NewRunner(name string) *Runner

NewRunner returns a new instance of Runner

func (*Runner) Add

func (r *Runner) Add(name string, f TaskFunction)

Add a new task to runner

func (*Runner) Group

func (r *Runner) Group(name string) *Runner

Add a new group to runner and return the group instance

func (*Runner) Run

func (r *Runner) Run() error

Run all tasks and groups

type Task

type Task struct {
	Name     string
	Function TaskFunction
}

Task store name and function for task

func (*Task) Run

func (t *Task) Run() error

Run executes the task

type TaskFunction

type TaskFunction func() error

TaskFunction defines the function for tasks

Jump to

Keyboard shortcuts

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