Documentation ¶
Index ¶
- Variables
- type Command
- func (c *Command) AddParams(params ...interface{}) *Command
- func (c *Command) AddParamsString(params ...string) *Command
- func (c *Command) MustExec()
- func (c *Command) MustOutput() string
- func (c *Command) MustRun()
- func (c *Command) Output() (string, error)
- func (c *Command) Run() error
- func (c *Command) SetDir(dir string) *Command
- func (c *Command) SetEnv(key, value string) *Command
- func (c *Command) SetEnvMap(m map[string]string) *Command
- func (c *Command) SetLogf(logf Logf) *Command
- func (c *Command) SetStderr(stderr io.Writer) *Command
- func (c *Command) SetStdin(stdin io.Reader) *Command
- func (c *Command) SetStdout(stdout io.Writer) *Command
- type Logf
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultLogf is the default implementation of Logf. DefaultLogf = func(cmd string, params ...interface{}) { fmt.Println(append([]interface{}{"[shell]", cmd}, params...)...) } )
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
Command describes a command to be spawned in a shell.
func NewCommand ¶
NewCommand creates a new Command.
func (*Command) AddParamsString ¶
AddParamsString appends the given params to the command.
func (*Command) MustExec ¶ added in v1.1.0
func (c *Command) MustExec()
MustExec replaces the current process using syscall.Exec with the Command. Note that: - It never returns. - It ignores stdin/stdout/stderr settings. - Unlike MustRun/MustOutput, it coerces params to strings using fmt.Sprintf.
func (*Command) MustOutput ¶
MustOutput is like Output but panics on error.
func (*Command) SetLogf ¶
SetLogf overrides DefaultLogf for this command. Set to nil to skip logging.
Click to show internal directories.
Click to hide internal directories.