tasks

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendFile added in v0.10.0

func AppendFile(template, output string, data interface{}) error

func Buffer added in v0.10.0

func Buffer(template string, data interface{}) (string, error)

func Command added in v0.10.0

func Command(name string, cmd string, args ...string) error

func CommandWithCwd added in v0.14.10

func CommandWithCwd(name, cwd, cmd string, args ...string) error

func Directory added in v0.10.0

func Directory(dir string) error

func File added in v0.10.0

func File(template, output string, data interface{}) error

func FileDoesntExist added in v0.10.0

func FileDoesntExist(template, output string, data interface{}) error

func GitInit added in v0.10.0

func GitInit() error

func GoFmt added in v0.10.0

func GoFmt() error

func GoGet added in v0.14.28

func GoGet(pkg string) error

func GoImports added in v0.10.0

func GoImports() error

func GoModInit added in v0.10.0

func GoModInit(repo string) error

func GoModTidy added in v0.10.0

func GoModTidy() error

func Modify added in v0.10.0

func Modify(output string, data interface{}) error

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

func Prettier added in v0.14.9

func Prettier(dir string) error

func RawFile added in v0.10.0

func RawFile(output string, data string) error

func ReadYaml added in v0.10.0

func ReadYaml(path string, object interface{}) error

ReadYaml reads a yaml file into a structure

func WriteYaml added in v0.10.0

func WriteYaml(path string, data interface{}) error

WriteYaml writes a yaml file from a structure

Types

type Runnable added in v0.10.0

type Runnable interface {
	Name() string
	Run() error
}

type Runner

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

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

func (r *Runner) Name() string

func (*Runner) Run

func (r *Runner) Run() error

Run all tasks and groups

type Task

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

Task store name and function for task

func (*Task) Name

func (t *Task) Name() string

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