run

package
v0.25.11 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TasksNew = kingpin.New

TasksNew ...

Functions

func GoBin added in v0.18.0

func GoBin() string

GoBin gets the current GOBIN properly

func GoPath added in v0.18.0

func GoPath() string

GoPath gets the current GOPATH properly

func GuardDefaultPatterns

func GuardDefaultPatterns() []string

GuardDefaultPatterns match all, then ignore all gitignore rules and all submodules

func KillTree

func KillTree(pid int) error

KillTree kill process and all its children process

func LookPath added in v0.18.0

func LookPath(name string) string

LookPath finds the executable from PATH and GOBIN, if nothing found the input value will be returned

func MustGoTool

func MustGoTool(path string)

MustGoTool try to find executable bin under GOPATH, if not exists run go get to download it

Types

type ExecContext

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

ExecContext ...

func Exec

func Exec(args ...string) *ExecContext

Exec executes os command and auto pipe stdout and stdin

func (*ExecContext) Args

func (ctx *ExecContext) Args(args []string) *ExecContext

Args sets arguments

func (*ExecContext) Context added in v0.19.0

func (ctx *ExecContext) Context(c context.Context) *ExecContext

Context sets the context of the Command

func (*ExecContext) Dir

func (ctx *ExecContext) Dir(dir string) *ExecContext

Dir sets the working dir to execute

func (*ExecContext) Do

func (ctx *ExecContext) Do() error

Do the exec.Cmd

func (*ExecContext) Env

func (ctx *ExecContext) Env(env ...string) *ExecContext

Env appends the current env with strings, each string should be something like "key=value"

func (*ExecContext) GetCmd

func (ctx *ExecContext) GetCmd() *exec.Cmd

GetCmd gets the exec.Cmd to execute

func (*ExecContext) MustDo

func (ctx *ExecContext) MustDo()

MustDo ...

func (*ExecContext) MustString

func (ctx *ExecContext) MustString() string

MustString ...

func (*ExecContext) NewEnv added in v0.18.0

func (ctx *ExecContext) NewEnv(env ...string) *ExecContext

NewEnv overrides the parrent Env with the env passed in

func (*ExecContext) Prefix

func (ctx *ExecContext) Prefix(p string) *ExecContext

Prefix sets the prefix string of the stdout and stderr

func (*ExecContext) Raw

func (ctx *ExecContext) Raw() *ExecContext

Raw enables the raw stdin mode

func (*ExecContext) String

func (ctx *ExecContext) String() (string, error)

String ...

type GuardContext

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

GuardContext ...

func Guard

func Guard(args ...string) *GuardContext

Guard run and guard a command, kill and rerun it if watched files are modified. Because it's based on polling, so it's cross-platform and file system. The args supports go template, variables {{path}}, {{file}}, {{op}} are available. The default patterns are GuardDefaultPatterns

func (*GuardContext) ClearScreen

func (ctx *GuardContext) ClearScreen() *GuardContext

ClearScreen clear screen before each run

func (*GuardContext) Debounce

func (ctx *GuardContext) Debounce(debounce *time.Duration) *GuardContext

Debounce suppress the frequency of the event

func (*GuardContext) Dir

func (ctx *GuardContext) Dir(d string) *GuardContext

Dir set dir

func (*GuardContext) Do

func (ctx *GuardContext) Do() error

Do run

func (*GuardContext) ExecCtx

func (ctx *GuardContext) ExecCtx(c *ExecContext) *GuardContext

ExecCtx ...

func (*GuardContext) Interval

func (ctx *GuardContext) Interval(interval *time.Duration) *GuardContext

Interval poll interval

func (*GuardContext) MustDo

func (ctx *GuardContext) MustDo()

MustDo ...

func (*GuardContext) NoInitRun

func (ctx *GuardContext) NoInitRun() *GuardContext

NoInitRun don't execute the cmd on startup

func (*GuardContext) Patterns

func (ctx *GuardContext) Patterns(patterns ...string) *GuardContext

Patterns set patterns

func (*GuardContext) Stop

func (ctx *GuardContext) Stop()

Stop stop watching

type TaskCmd

type TaskCmd = *kingpin.CmdClause

TaskCmd ...

type TaskContext

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

TaskContext ...

func Task

func Task(name, help string) *TaskContext

Task ...

func (*TaskContext) Init

func (ctx *TaskContext) Init(f func(TaskCmd) func()) *TaskContext

Init ...

func (*TaskContext) Run

func (ctx *TaskContext) Run(f func()) *TaskContext

Run ...

type TasksContext

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

TasksContext ...

func Tasks

func Tasks() *TasksContext

Tasks a simple wrapper for kingpin to make it easier to use

func (*TasksContext) Add

func (ctx *TasksContext) Add(tasks ...*TaskContext) *TasksContext

Add ...

func (*TasksContext) App

func (ctx *TasksContext) App(app *kingpin.Application) *TasksContext

App ...

func (*TasksContext) Do

func (ctx *TasksContext) Do()

Do ...

Directories

Path Synopsis
fixtures

Jump to

Keyboard shortcuts

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