Documentation ¶
Index ¶
- Constants
- type DefaultExecer
- func (e DefaultExecer) Arch() string
- func (e DefaultExecer) Command(name string, arg ...string) ([]byte, error)
- func (e DefaultExecer) LookPath(file string) (string, error)
- func (e DefaultExecer) OS() string
- func (e DefaultExecer) RunCommand(name string, arg ...string) error
- func (e DefaultExecer) RunCommandAndReturn(name, dir string, args ...string) (result string, err error)
- func (e DefaultExecer) RunCommandInDir(name, dir string, args ...string) error
- func (e DefaultExecer) RunCommandWithBuffer(name, dir string, stdout, stderr *bytes.Buffer, args ...string) error
- func (e DefaultExecer) RunCommandWithIO(name, dir string, stdout, stderr io.Writer, args ...string) (err error)
- func (e DefaultExecer) RunCommandWithSudo(name string, args ...string) (err error)
- type Execer
- type FakeExecer
- func (f FakeExecer) Arch() string
- func (f FakeExecer) Command(name string, arg ...string) ([]byte, error)
- func (f FakeExecer) LookPath(path string) (string, error)
- func (f FakeExecer) OS() string
- func (f FakeExecer) RunCommand(name string, arg ...string) error
- func (f FakeExecer) RunCommandAndReturn(name, dir string, args ...string) (result string, err error)
- func (f FakeExecer) RunCommandInDir(name, dir string, args ...string) error
- func (f FakeExecer) RunCommandWithBuffer(name, dir string, stdout, stderr *bytes.Buffer, args ...string) error
- func (f FakeExecer) RunCommandWithIO(name, dir string, stdout, stderr io.Writer, args ...string) error
- func (f FakeExecer) RunCommandWithSudo(name string, args ...string) (err error)
Constants ¶
const ( // OSLinux is the alias of Linux OSLinux = "linux" // OSDarwin is the alias of Darwin OSDarwin = "darwin" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultExecer ¶ added in v0.0.68
type DefaultExecer struct { }
DefaultExecer is a wrapper for the OS exec
func (DefaultExecer) Arch ¶ added in v0.0.73
func (e DefaultExecer) Arch() string
Arch returns the os arch
func (DefaultExecer) Command ¶ added in v0.0.73
func (e DefaultExecer) Command(name string, arg ...string) ([]byte, error)
Command is the wrapper of os/exec.Command
func (DefaultExecer) LookPath ¶ added in v0.0.68
func (e DefaultExecer) LookPath(file string) (string, error)
LookPath is the wrapper of os/exec.LookPath
func (DefaultExecer) OS ¶ added in v0.0.73
func (e DefaultExecer) OS() string
OS returns the os name
func (DefaultExecer) RunCommand ¶ added in v0.0.73
func (e DefaultExecer) RunCommand(name string, arg ...string) error
RunCommand runs a command
func (DefaultExecer) RunCommandAndReturn ¶ added in v0.0.73
func (e DefaultExecer) RunCommandAndReturn(name, dir string, args ...string) (result string, err error)
RunCommandAndReturn runs a command, then returns the output
func (DefaultExecer) RunCommandInDir ¶ added in v0.0.73
func (e DefaultExecer) RunCommandInDir(name, dir string, args ...string) error
RunCommandInDir runs a command
func (DefaultExecer) RunCommandWithBuffer ¶ added in v0.0.73
func (e DefaultExecer) RunCommandWithBuffer(name, dir string, stdout, stderr *bytes.Buffer, args ...string) error
RunCommandWithBuffer runs a command with buffer stdout and stderr could be nil
func (DefaultExecer) RunCommandWithIO ¶ added in v0.0.73
func (e DefaultExecer) RunCommandWithIO(name, dir string, stdout, stderr io.Writer, args ...string) (err error)
RunCommandWithIO runs a command with given IO
func (DefaultExecer) RunCommandWithSudo ¶ added in v0.0.73
func (e DefaultExecer) RunCommandWithSudo(name string, args ...string) (err error)
RunCommandWithSudo runs a command with sudo
type Execer ¶ added in v0.0.68
type Execer interface { LookPath(string) (string, error) Command(name string, arg ...string) ([]byte, error) RunCommand(name string, arg ...string) (err error) RunCommandInDir(name, dir string, args ...string) error RunCommandAndReturn(name, dir string, args ...string) (result string, err error) RunCommandWithSudo(name string, args ...string) (err error) RunCommandWithBuffer(name, dir string, stdout, stderr *bytes.Buffer, args ...string) error RunCommandWithIO(name, dir string, stdout, stderr io.Writer, args ...string) (err error) OS() string Arch() string }
Execer is an interface for OS-related operations
type FakeExecer ¶ added in v0.0.68
FakeExecer is for the unit test purposes
func (FakeExecer) Arch ¶ added in v0.0.73
func (f FakeExecer) Arch() string
Arch returns the os arch
func (FakeExecer) Command ¶ added in v0.0.73
func (f FakeExecer) Command(name string, arg ...string) ([]byte, error)
Command is a fake method
func (FakeExecer) LookPath ¶ added in v0.0.68
func (f FakeExecer) LookPath(path string) (string, error)
LookPath is a fake method
func (FakeExecer) RunCommand ¶ added in v0.0.73
func (f FakeExecer) RunCommand(name string, arg ...string) error
RunCommand runs a command
func (FakeExecer) RunCommandAndReturn ¶ added in v0.0.73
func (f FakeExecer) RunCommandAndReturn(name, dir string, args ...string) (result string, err error)
RunCommandAndReturn is a fake method
func (FakeExecer) RunCommandInDir ¶ added in v0.0.73
func (f FakeExecer) RunCommandInDir(name, dir string, args ...string) error
RunCommandInDir is a fake method
func (FakeExecer) RunCommandWithBuffer ¶ added in v0.0.73
func (f FakeExecer) RunCommandWithBuffer(name, dir string, stdout, stderr *bytes.Buffer, args ...string) error
RunCommandWithBuffer is a fake method
func (FakeExecer) RunCommandWithIO ¶ added in v0.0.73
func (f FakeExecer) RunCommandWithIO(name, dir string, stdout, stderr io.Writer, args ...string) error
RunCommandWithIO is a fake method
func (FakeExecer) RunCommandWithSudo ¶ added in v0.0.73
func (f FakeExecer) RunCommandWithSudo(name string, args ...string) (err error)
RunCommandWithSudo is a fake method