Documentation ¶
Overview ¶
Package exe enables template completion before command execution.
Index ¶
- func Execute(s string, obj interface{}, settings ...SettingsFunc) *exec.Cmd
- func ExecuteE(s string, obj interface{}, settings ...SettingsFunc) (*exec.Cmd, error)
- func ExecuteEWithContext(ctx context.Context, s string, obj interface{}, settings ...SettingsFunc) (*exec.Cmd, error)
- func ExecuteWithContext(ctx context.Context, s string, obj interface{}, settings ...SettingsFunc) *exec.Cmd
- func ExecuteWithOutput(s string, obj interface{}, settings ...SettingsFunc) string
- func ExecuteWithOutputE(s string, obj interface{}, settings ...SettingsFunc) (out string, err error)
- func Run(cmd *exec.Cmd, name string, settings ...SettingsFunc)
- func RunE(cmd *exec.Cmd, name string, settings ...SettingsFunc) (err error)
- func RunWithOutput(cmd *exec.Cmd, name string, settings ...SettingsFunc) string
- func RunWithOutputE(cmd *exec.Cmd, name string, settings ...SettingsFunc) (out string, err error)
- func SplitCommand(s string) []string
- func WithStart(s *ExecuteSetting)
- type ExecuteSetting
- type Runner
- type SettingsFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Execute ¶
func Execute(s string, obj interface{}, settings ...SettingsFunc) *exec.Cmd
Execute runs the function on the default Runner.
func ExecuteE ¶
func ExecuteE(s string, obj interface{}, settings ...SettingsFunc) (*exec.Cmd, error)
ExecuteE runs the function on the default Runner.
func ExecuteEWithContext ¶
func ExecuteEWithContext(ctx context.Context, s string, obj interface{}, settings ...SettingsFunc) (*exec.Cmd, error)
ExecuteE runs the function on the default Runner.
func ExecuteWithContext ¶
func ExecuteWithContext(ctx context.Context, s string, obj interface{}, settings ...SettingsFunc) *exec.Cmd
Execute runs the function on the default Runner.
func ExecuteWithOutput ¶
func ExecuteWithOutput(s string, obj interface{}, settings ...SettingsFunc) string
ExecuteWithOutput runs the function on the default Runner.
func ExecuteWithOutputE ¶
func ExecuteWithOutputE(s string, obj interface{}, settings ...SettingsFunc) (out string, err error)
ExecuteWithOutputE runs the command on the default runner.
func Run ¶
func Run(cmd *exec.Cmd, name string, settings ...SettingsFunc)
Run runs the function on the default Runner.
func RunE ¶
func RunE(cmd *exec.Cmd, name string, settings ...SettingsFunc) (err error)
RunE runs the function on the default Runner.
func RunWithOutput ¶
func RunWithOutput(cmd *exec.Cmd, name string, settings ...SettingsFunc) string
RunWithOutput runs the function on the default Runner.
func RunWithOutputE ¶
RunWithOutputE runs the function on the default Runner.
func SplitCommand ¶
SplitCommand runs the function on the default Runner.
Types ¶
type ExecuteSetting ¶
type ExecuteSetting struct {
// contains filtered or unexported fields
}
ExecuteSetting holds options to apply to a command runner.
type Runner ¶
type Runner interface { Run(cmd *exec.Cmd, name string, settings ...SettingsFunc) RunE(cmd *exec.Cmd, name string, settings ...SettingsFunc) (err error) RunWithOutput(cmd *exec.Cmd, name string, settings ...SettingsFunc) string RunWithOutputE(cmd *exec.Cmd, name string, settings ...SettingsFunc) (out string, err error) Execute(s string, obj interface{}, settings ...SettingsFunc) *exec.Cmd ExecuteE(s string, obj interface{}, settings ...SettingsFunc) (*exec.Cmd, error) SplitCommand(string) []string ExecuteWithContext(ctx context.Context, s string, obj interface{}, settings ...SettingsFunc) *exec.Cmd ExecuteEWithContext(ctx context.Context, s string, obj interface{}, settings ...SettingsFunc) (*exec.Cmd, error) ExecuteWithOutput(s string, obj interface{}, settings ...SettingsFunc) string ExecuteWithOutputE(s string, obj interface{}, settings ...SettingsFunc) (out string, err error) }
Runner combines all run functions into one interface.
func DefaultRunner ¶
func DefaultRunner() Runner
DefaultRunner returns the default Runner implementation.
type SettingsFunc ¶
type SettingsFunc func(s *ExecuteSetting)
SettingsFunc is a function which modifies the execution setting.
func WithDir ¶
func WithDir(path string) SettingsFunc
WithDir sets working directory to use when running the command.
func WithTimeout ¶
func WithTimeout(duration time.Duration) SettingsFunc
WithTimeout sets a maximum duration to wait.