Versions in this module Expand all Collapse all v1 v1.22.2 Apr 24, 2024 v1.21.3 Jan 6, 2024 v1.21.0 Dec 26, 2023 Changes in this version + var ErrUnexpectedSuccess = errors.New("unexpected success") + var ErrUsage = errors.New("invalid usage") + func DefaultCmds() map[string]Cmd + func DefaultConds() map[string]Cond + type Cmd interface + Run func(s *State, args ...string) (WaitFunc, error) + Usage func() *CmdUsage + func Cat() Cmd + func Cd() Cmd + func Chmod() Cmd + func Cmp() Cmd + func Cmpenv() Cmd + func Command(usage CmdUsage, run func(*State, ...string) (WaitFunc, error)) Cmd + func Cp() Cmd + func Echo() Cmd + func Env() Cmd + func Exec(cancel func(*exec.Cmd) error, waitDelay time.Duration) Cmd + func Exists() Cmd + func Grep() Cmd + func Help() Cmd + func Mkdir() Cmd + func Mv() Cmd + func Program(name string, cancel func(*exec.Cmd) error, waitDelay time.Duration) Cmd + func Replace() Cmd + func Rm() Cmd + func Sleep() Cmd + func Stderr() Cmd + func Stdout() Cmd + func Stop() Cmd + func Symlink() Cmd + func Wait() Cmd + type CmdUsage struct + Args string + Async bool + Detail []string + RegexpArgs func(rawArgs ...string) []int + Summary string + type CommandError struct + Args []string + Err error + File string + Line int + Op string + func (e *CommandError) Error() string + func (e *CommandError) Unwrap() error + type Cond interface + Eval func(s *State, suffix string) (bool, error) + Usage func() *CondUsage + func BoolCondition(summary string, v bool) Cond + func CachedCondition(summary string, eval func(string) (bool, error)) Cond + func Condition(summary string, eval func(*State) (bool, error)) Cond + func OnceCondition(summary string, eval func() (bool, error)) Cond + func PrefixCondition(summary string, eval func(*State, string) (bool, error)) Cond + type CondUsage struct + Prefix bool + Summary string + type Engine struct + Cmds map[string]Cmd + Conds map[string]Cond + Quiet bool + func NewEngine() *Engine + func (e *Engine) Execute(s *State, file string, script *bufio.Reader, log io.Writer) (err error) + func (e *Engine) ListCmds(w io.Writer, verbose bool, names ...string) error + func (e *Engine) ListConds(w io.Writer, s *State, tags ...string) error + type State struct + func NewState(ctx context.Context, workdir string, initialEnv []string) (*State, error) + func (s *State) Chdir(path string) error + func (s *State) CloseAndWait(log io.Writer) error + func (s *State) Context() context.Context + func (s *State) Environ() []string + func (s *State) ExpandEnv(str string, inRegexp bool) string + func (s *State) ExtractFiles(ar *txtar.Archive) error + func (s *State) Getwd() string + func (s *State) Logf(format string, args ...any) + func (s *State) LookupEnv(key string) (string, bool) + func (s *State) Path(path string) string + func (s *State) Setenv(key, value string) error + func (s *State) Stderr() string + func (s *State) Stdout() string + type UsageError struct + Command Cmd + Name string + func (e *UsageError) Error() string + type WaitFunc func(*State) (stdout, stderr string, err error)