cmd

package
v0.0.0-...-f4a649d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2025 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckIllegal

func CheckIllegal(args ...string) bool

func RunDefaultBashC

func RunDefaultBashC(command string) error

func RunDefaultBashCf

func RunDefaultBashCf(command string, arg ...interface{}) error

func RunDefaultWithStdoutBashC

func RunDefaultWithStdoutBashC(command string) (string, error)

func RunDefaultWithStdoutBashCf

func RunDefaultWithStdoutBashCf(command string, arg ...interface{}) (string, error)

func RunDefaultWithStdoutBashCfAndTimeOut

func RunDefaultWithStdoutBashCfAndTimeOut(command string, timeout time.Duration, arg ...interface{}) (string, error)

func SudoHandleCmd

func SudoHandleCmd() string

func Which

func Which(name string) bool

Types

type CommandHelper

type CommandHelper struct {
	IgnoreExist1 bool
	// contains filtered or unexported fields
}

func NewCommandMgr

func NewCommandMgr(opts ...Option) *CommandHelper

func (*CommandHelper) Run

func (c *CommandHelper) Run(name string, arg ...string) error

func (*CommandHelper) RunBashC

func (c *CommandHelper) RunBashC(command string) error

func (*CommandHelper) RunBashCWithArgs

func (c *CommandHelper) RunBashCWithArgs(arg ...string) error

func (*CommandHelper) RunBashCf

func (c *CommandHelper) RunBashCf(command string, arg ...interface{}) error

func (*CommandHelper) RunWithStdout

func (c *CommandHelper) RunWithStdout(name string, arg ...string) (string, error)

func (*CommandHelper) RunWithStdoutBashC

func (c *CommandHelper) RunWithStdoutBashC(command string) (string, error)

func (*CommandHelper) RunWithStdoutBashCf

func (c *CommandHelper) RunWithStdoutBashCf(command string, arg ...interface{}) (string, error)

type CustomWriter

type CustomWriter struct {
	// contains filtered or unexported fields
}

func (*CustomWriter) Flush

func (cw *CustomWriter) Flush()

func (*CustomWriter) Write

func (cw *CustomWriter) Write(p []byte) (n int, err error)

type Option

type Option func(*CommandHelper)

func WithContext

func WithContext(ctx context.Context) Option

func WithIgnoreExist1

func WithIgnoreExist1() Option

func WithLogger

func WithLogger(logger *log.Logger) Option

func WithOutputFile

func WithOutputFile(outputFile string) Option

func WithScriptPath

func WithScriptPath(scriptPath string) Option

func WithTask

func WithTask(taskItem task.Task) Option

func WithTimeout

func WithTimeout(timeout time.Duration) Option

func WithWorkDir

func WithWorkDir(workDir string) Option

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL