grift

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2019 License: MIT Imports: 10 Imported by: 346

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommandName = "grift"

Functions

func Add

func Add(name string, grift Grift) error

Add a grift. If there is already a grift with the given name the two grifts will be bundled together.

func Desc

func Desc(name string, description string) error

Desc sets a helpful descriptive text for a grift. This description will be shown when `grift list` is run.

func Exec

func Exec(args []string, verbose bool) error

Exec the grift stack. This is the main "entry point" to the grift system.

func List

func List() []string

List of the names of the defined grifts.

func Namespace

func Namespace(name string, s func()) error

Namespace will place all tasks within the given prefix.

func PrintGrifts

func PrintGrifts(w io.Writer)

PrintGrifts to the screen, nice, sorted, and with descriptions, should they exist.

func Remove

func Remove(name string) error

Remove a grift. Not incredibly useful, but here for completeness.

func Rename

func Rename(oldName string, newName string) error

Rename a grift. Useful if you want to re-define an existing grift, but don't want to write over the original.

func Run

func Run(name string, c *Context) error

Run a grift. This allows for the chaining for grifts. One grift can Run another grift and so on.

func RunSource

func RunSource(cmd *exec.Cmd) error

RunSource executes the command passed as argument, in the current shell/context

func Set

func Set(name string, grift Grift) error

Set a grift. This is similar to `Add` but it will overwrite an existing grift with the same name.

Types

type Context

type Context struct {
	context.Context
	Name    string
	Args    []string
	Verbose bool
	// contains filtered or unexported fields
}

Context used to pass information between grifts

func NewContext

func NewContext(name string) *Context

NewContext builds and returns a new default Context.

func NewContextWithContext

func NewContextWithContext(name string, ctx context.Context) *Context

NewContextWithContext builds and returns a new default Context given an existing context

func (*Context) Set

func (c *Context) Set(key string, val interface{})

Set a piece of data onto the Context.

func (*Context) Value

func (c *Context) Value(key interface{}) interface{}

Value returns a value from the context for the given key

type Grift

type Grift func(c *Context) error

Jump to

Keyboard shortcuts

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