Documentation
¶
Index ¶
- func CheckIllegal(args ...string) bool
- func ExecCommandWithOptionalSudo(name string, args ...string) *exec.Cmd
- func RunDockerExec(timeout time.Duration, containerName string, args ...string) error
- func RunDockerExecWithStdout(timeout time.Duration, containerName string, args ...string) (string, error)
- func SudoHandleCmd() string
- func Which(name string) bool
- func WrapWithOptionalSudo(name string, args ...string) (string, []string)
- func WriteFileWithOptionalSudo(name string, data []byte, perm os.FileMode) error
- type CommandHelper
- func (c *CommandHelper) Run(name string, arg ...string) error
- func (c *CommandHelper) RunPipe(commands ...PipeCommand) (string, error)
- func (c *CommandHelper) RunPipeToFile(outputFile string, commands ...PipeCommand) (string, error)
- func (c *CommandHelper) RunWithOptionalSudo(name string, arg ...string) error
- func (c *CommandHelper) RunWithOptionalSudoAndStdout(name string, arg ...string) (string, error)
- func (c *CommandHelper) RunWithStdout(name string, arg ...string) (string, error)
- type CustomWriter
- type Option
- func WithContext(ctx context.Context) Option
- func WithEnv(env ...string) Option
- func WithIgnoreExist1() Option
- func WithLogger(logger *log.Logger) Option
- func WithOutputFile(outputFile string) Option
- func WithScriptPath(scriptPath string) Option
- func WithStdin(stdin io.Reader) Option
- func WithTask(taskItem task.Task) Option
- func WithTimeout(timeout time.Duration) Option
- func WithWorkDir(workDir string) Option
- type PipeCommand
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckIllegal ¶
func RunDockerExec ¶
func RunDockerExecWithStdout ¶
func SudoHandleCmd ¶
func SudoHandleCmd() string
func WrapWithOptionalSudo ¶
Types ¶
type CommandHelper ¶
type CommandHelper struct {
IgnoreExist1 bool
// contains filtered or unexported fields
}
func NewCommandMgr ¶
func NewCommandMgr(opts ...Option) *CommandHelper
func (*CommandHelper) RunPipe ¶
func (c *CommandHelper) RunPipe(commands ...PipeCommand) (string, error)
func (*CommandHelper) RunPipeToFile ¶
func (c *CommandHelper) RunPipeToFile(outputFile string, commands ...PipeCommand) (string, error)
func (*CommandHelper) RunWithOptionalSudo ¶
func (c *CommandHelper) RunWithOptionalSudo(name string, arg ...string) error
func (*CommandHelper) RunWithOptionalSudoAndStdout ¶
func (c *CommandHelper) RunWithOptionalSudoAndStdout(name string, arg ...string) (string, error)
func (*CommandHelper) RunWithStdout ¶
func (c *CommandHelper) RunWithStdout(name string, arg ...string) (string, error)
type CustomWriter ¶
type CustomWriter struct {
// contains filtered or unexported fields
}
func (*CustomWriter) Flush ¶
func (cw *CustomWriter) Flush()
type Option ¶
type Option func(*CommandHelper)
func WithContext ¶
func WithIgnoreExist1 ¶
func WithIgnoreExist1() Option
func WithLogger ¶
func WithOutputFile ¶
func WithScriptPath ¶
func WithTimeout ¶
func WithWorkDir ¶
Click to show internal directories.
Click to hide internal directories.