Documentation ¶
Index ¶
- func Exec(name string, args ...string) ([]byte, error)
- func ExecInEnvs(envs []string, name string, args ...string) ([]byte, error)
- func ExecInPath(path string, name string, args ...string) ([]byte, error)
- func ExecXshRun(shellType, shellFlag string, name string, args ...string) ([]byte, error)
- func SetDebugMode(enable bool)
- type CMC
- type CommandConfig
- func (c *CommandConfig) Exec(name string, args ...string) ([]byte, error)
- func (c *CommandConfig) ExecInPipe(name string, args ...string) ([]byte, error)
- func (c *CommandConfig) Must() *CommandConfig88Must
- func (c *CommandConfig) Omit() *CommandConfig88Omit
- func (c *CommandConfig) Soft() *CommandConfig88Soft
- func (c *CommandConfig) StreamExec(name string, args ...string) ([]byte, error)
- func (c *CommandConfig) WithBash() *CommandConfig
- func (c *CommandConfig) WithDebug() *CommandConfig
- func (c *CommandConfig) WithDebugMode(debugMode bool) *CommandConfig
- func (c *CommandConfig) WithEnvs(envs []string) *CommandConfig
- func (c *CommandConfig) WithMatchMore(matchMore bool) *CommandConfig
- func (c *CommandConfig) WithMatchPipe(matchPipe func(line string) bool) *CommandConfig
- func (c *CommandConfig) WithPath(path string) *CommandConfig
- func (c *CommandConfig) WithSh() *CommandConfig
- func (c *CommandConfig) WithShell(shellType, shellFlag string) *CommandConfig
- func (c *CommandConfig) WithShellFlag(shellFlag string) *CommandConfig
- func (c *CommandConfig) WithShellType(shellType string) *CommandConfig
- func (c *CommandConfig) WithZsh() *CommandConfig
- type CommandConfig88Must
- func (T *CommandConfig88Must) Exec(name string, args ...string) (res []byte)
- func (T *CommandConfig88Must) ExecInPipe(name string, args ...string) (res []byte)
- func (T *CommandConfig88Must) StreamExec(name string, args ...string) (res []byte)
- func (T *CommandConfig88Must) WithBash() (res *CommandConfig)
- func (T *CommandConfig88Must) WithDebug() (res *CommandConfig)
- func (T *CommandConfig88Must) WithDebugMode(debugMode bool) (res *CommandConfig)
- func (T *CommandConfig88Must) WithEnvs(envs []string) (res *CommandConfig)
- func (T *CommandConfig88Must) WithMatchMore(matchMore bool) (res *CommandConfig)
- func (T *CommandConfig88Must) WithMatchPipe(matchPipe func(line string) bool) (res *CommandConfig)
- func (T *CommandConfig88Must) WithPath(path string) (res *CommandConfig)
- func (T *CommandConfig88Must) WithSh() (res *CommandConfig)
- func (T *CommandConfig88Must) WithShell(shellType string, shellFlag string) (res *CommandConfig)
- func (T *CommandConfig88Must) WithShellFlag(shellFlag string) (res *CommandConfig)
- func (T *CommandConfig88Must) WithShellType(shellType string) (res *CommandConfig)
- func (T *CommandConfig88Must) WithZsh() (res *CommandConfig)
- type CommandConfig88Omit
- func (T *CommandConfig88Omit) Exec(name string, args ...string) (res []byte)
- func (T *CommandConfig88Omit) ExecInPipe(name string, args ...string) (res []byte)
- func (T *CommandConfig88Omit) StreamExec(name string, args ...string) (res []byte)
- func (T *CommandConfig88Omit) WithBash() (res *CommandConfig)
- func (T *CommandConfig88Omit) WithDebug() (res *CommandConfig)
- func (T *CommandConfig88Omit) WithDebugMode(debugMode bool) (res *CommandConfig)
- func (T *CommandConfig88Omit) WithEnvs(envs []string) (res *CommandConfig)
- func (T *CommandConfig88Omit) WithMatchMore(matchMore bool) (res *CommandConfig)
- func (T *CommandConfig88Omit) WithMatchPipe(matchPipe func(line string) bool) (res *CommandConfig)
- func (T *CommandConfig88Omit) WithPath(path string) (res *CommandConfig)
- func (T *CommandConfig88Omit) WithSh() (res *CommandConfig)
- func (T *CommandConfig88Omit) WithShell(shellType string, shellFlag string) (res *CommandConfig)
- func (T *CommandConfig88Omit) WithShellFlag(shellFlag string) (res *CommandConfig)
- func (T *CommandConfig88Omit) WithShellType(shellType string) (res *CommandConfig)
- func (T *CommandConfig88Omit) WithZsh() (res *CommandConfig)
- type CommandConfig88Soft
- func (T *CommandConfig88Soft) Exec(name string, args ...string) (res []byte)
- func (T *CommandConfig88Soft) ExecInPipe(name string, args ...string) (res []byte)
- func (T *CommandConfig88Soft) StreamExec(name string, args ...string) (res []byte)
- func (T *CommandConfig88Soft) WithBash() (res *CommandConfig)
- func (T *CommandConfig88Soft) WithDebug() (res *CommandConfig)
- func (T *CommandConfig88Soft) WithDebugMode(debugMode bool) (res *CommandConfig)
- func (T *CommandConfig88Soft) WithEnvs(envs []string) (res *CommandConfig)
- func (T *CommandConfig88Soft) WithMatchMore(matchMore bool) (res *CommandConfig)
- func (T *CommandConfig88Soft) WithMatchPipe(matchPipe func(line string) bool) (res *CommandConfig)
- func (T *CommandConfig88Soft) WithPath(path string) (res *CommandConfig)
- func (T *CommandConfig88Soft) WithSh() (res *CommandConfig)
- func (T *CommandConfig88Soft) WithShell(shellType string, shellFlag string) (res *CommandConfig)
- func (T *CommandConfig88Soft) WithShellFlag(shellFlag string) (res *CommandConfig)
- func (T *CommandConfig88Soft) WithShellType(shellType string) (res *CommandConfig)
- func (T *CommandConfig88Soft) WithZsh() (res *CommandConfig)
- type OsCommand
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecInEnvs ¶
ExecInEnvs executes a command with custom environment variables. ExecInEnvs 使用自定义环境变量执行一个命令。
func ExecInPath ¶
ExecInPath executes a command in a specified directory. ExecInPath 在指定的目录中执行一个命令。
func ExecXshRun ¶
ExecXshRun executes a command using a specific shell type and shell flag. ExecXshRun 使用指定的 shell 类型和 shell 标志执行一个命令。
func SetDebugMode ¶ added in v0.0.8
func SetDebugMode(enable bool)
Types ¶
type CMC ¶ added in v0.0.2
type CMC = CommandConfig
type CommandConfig ¶ added in v0.0.5
type CommandConfig struct { Envs []string // Optional environment variables. // 填写可选的环境变量。 Path string // Optional execution path. // 填写可选的执行路径。 ShellType string // Optional type of shell to use, e.g., bash, zsh. // 填写可选的 shell 类型,例如 bash,zsh。 ShellFlag string // Optional shell flag, e.g., "-c". // 填写可选的 Shell 参数,例如 "-c"。 DebugMode bool // enable debug mode. // 是否启用调试模式,即打印调试的日志。 MatchPipe func(line string) bool MatchMore bool }
CommandConfig represents the configuration for executing shell commands. CommandConfig 表示执行 shell 命令的配置。
func NewCommandConfig ¶ added in v0.0.5
func NewCommandConfig() *CommandConfig
NewCommandConfig creates and returns a new CommandConfig instance. NewCommandConfig 创建并返回一个新的 CommandConfig 实例。
func (*CommandConfig) Exec ¶ added in v0.0.5
func (c *CommandConfig) Exec(name string, args ...string) ([]byte, error)
Exec executes a shell command with the specified name and arguments, using the CommandConfig configuration. Exec 使用 CommandConfig 的配置执行带有指定名称和参数的 shell 命令。
func (*CommandConfig) ExecInPipe ¶ added in v0.0.11
func (c *CommandConfig) ExecInPipe(name string, args ...string) ([]byte, error)
func (*CommandConfig) Must ¶ added in v0.0.6
func (c *CommandConfig) Must() *CommandConfig88Must
func (*CommandConfig) Omit ¶ added in v0.0.6
func (c *CommandConfig) Omit() *CommandConfig88Omit
func (*CommandConfig) Soft ¶ added in v0.0.6
func (c *CommandConfig) Soft() *CommandConfig88Soft
func (*CommandConfig) StreamExec ¶ added in v0.0.9
func (c *CommandConfig) StreamExec(name string, args ...string) ([]byte, error)
func (*CommandConfig) WithBash ¶ added in v0.0.5
func (c *CommandConfig) WithBash() *CommandConfig
WithBash sets the shell to bash with the "-c" flag and returns the updated instance. WithBash 设置 shell 为 bash 并附带 "-c" 参数,返回更新后的实例。
func (*CommandConfig) WithDebug ¶ added in v0.0.15
func (c *CommandConfig) WithDebug() *CommandConfig
func (*CommandConfig) WithDebugMode ¶ added in v0.0.5
func (c *CommandConfig) WithDebugMode(debugMode bool) *CommandConfig
WithDebugMode sets the debug mode for CommandConfig and returns the updated instance. WithDebugMode 设置 CommandConfig 的调试模式并返回更新后的实例。
func (*CommandConfig) WithEnvs ¶ added in v0.0.5
func (c *CommandConfig) WithEnvs(envs []string) *CommandConfig
WithEnvs sets the environment variables for CommandConfig and returns the updated instance. WithEnvs 设置 CommandConfig 的环境变量并返回更新后的实例。
func (*CommandConfig) WithMatchMore ¶ added in v0.0.14
func (c *CommandConfig) WithMatchMore(matchMore bool) *CommandConfig
func (*CommandConfig) WithMatchPipe ¶ added in v0.0.12
func (c *CommandConfig) WithMatchPipe(matchPipe func(line string) bool) *CommandConfig
func (*CommandConfig) WithPath ¶ added in v0.0.5
func (c *CommandConfig) WithPath(path string) *CommandConfig
WithPath sets the execution path for CommandConfig and returns the updated instance. WithPath 设置 CommandConfig 的执行路径并返回更新后的实例。
func (*CommandConfig) WithSh ¶ added in v0.0.5
func (c *CommandConfig) WithSh() *CommandConfig
WithSh sets the shell to sh with the "-c" flag and returns the updated instance. WithSh 设置 shell 为 sh 并附带 "-c" 参数,返回更新后的实例。
func (*CommandConfig) WithShell ¶ added in v0.0.5
func (c *CommandConfig) WithShell(shellType, shellFlag string) *CommandConfig
WithShell sets both the shell type and shell flag for CommandConfig and returns the updated instance. WithShell 同时设置 CommandConfig 的 shell 类型和 shell 参数,并返回更新后的实例。
func (*CommandConfig) WithShellFlag ¶ added in v0.0.5
func (c *CommandConfig) WithShellFlag(shellFlag string) *CommandConfig
WithShellFlag sets the shell flag for CommandConfig and returns the updated instance. WithShellFlag 设置 CommandConfig 的 shell 参数并返回更新后的实例。
func (*CommandConfig) WithShellType ¶ added in v0.0.5
func (c *CommandConfig) WithShellType(shellType string) *CommandConfig
WithShellType sets the shell type for CommandConfig and returns the updated instance. WithShellType 设置 CommandConfig 的 shell 类型并返回更新后的实例。
func (*CommandConfig) WithZsh ¶ added in v0.0.5
func (c *CommandConfig) WithZsh() *CommandConfig
WithZsh sets the shell to zsh with the "-c" flag and returns the updated instance. WithZsh 设置 shell 为 zsh 并附带 "-c" 参数,返回更新后的实例。
type CommandConfig88Must ¶ added in v0.0.6
type CommandConfig88Must struct {
// contains filtered or unexported fields
}
func (*CommandConfig88Must) Exec ¶ added in v0.0.6
func (T *CommandConfig88Must) Exec(name string, args ...string) (res []byte)
func (*CommandConfig88Must) ExecInPipe ¶ added in v0.0.16
func (T *CommandConfig88Must) ExecInPipe(name string, args ...string) (res []byte)
func (*CommandConfig88Must) StreamExec ¶ added in v0.0.10
func (T *CommandConfig88Must) StreamExec(name string, args ...string) (res []byte)
func (*CommandConfig88Must) WithBash ¶ added in v0.0.6
func (T *CommandConfig88Must) WithBash() (res *CommandConfig)
func (*CommandConfig88Must) WithDebug ¶ added in v0.0.16
func (T *CommandConfig88Must) WithDebug() (res *CommandConfig)
func (*CommandConfig88Must) WithDebugMode ¶ added in v0.0.6
func (T *CommandConfig88Must) WithDebugMode(debugMode bool) (res *CommandConfig)
func (*CommandConfig88Must) WithEnvs ¶ added in v0.0.6
func (T *CommandConfig88Must) WithEnvs(envs []string) (res *CommandConfig)
func (*CommandConfig88Must) WithMatchMore ¶ added in v0.0.16
func (T *CommandConfig88Must) WithMatchMore(matchMore bool) (res *CommandConfig)
func (*CommandConfig88Must) WithMatchPipe ¶ added in v0.0.16
func (T *CommandConfig88Must) WithMatchPipe(matchPipe func(line string) bool) (res *CommandConfig)
func (*CommandConfig88Must) WithPath ¶ added in v0.0.6
func (T *CommandConfig88Must) WithPath(path string) (res *CommandConfig)
func (*CommandConfig88Must) WithSh ¶ added in v0.0.6
func (T *CommandConfig88Must) WithSh() (res *CommandConfig)
func (*CommandConfig88Must) WithShell ¶ added in v0.0.6
func (T *CommandConfig88Must) WithShell(shellType string, shellFlag string) (res *CommandConfig)
func (*CommandConfig88Must) WithShellFlag ¶ added in v0.0.6
func (T *CommandConfig88Must) WithShellFlag(shellFlag string) (res *CommandConfig)
func (*CommandConfig88Must) WithShellType ¶ added in v0.0.6
func (T *CommandConfig88Must) WithShellType(shellType string) (res *CommandConfig)
func (*CommandConfig88Must) WithZsh ¶ added in v0.0.6
func (T *CommandConfig88Must) WithZsh() (res *CommandConfig)
type CommandConfig88Omit ¶ added in v0.0.6
type CommandConfig88Omit struct {
// contains filtered or unexported fields
}
func (*CommandConfig88Omit) Exec ¶ added in v0.0.6
func (T *CommandConfig88Omit) Exec(name string, args ...string) (res []byte)
func (*CommandConfig88Omit) ExecInPipe ¶ added in v0.0.16
func (T *CommandConfig88Omit) ExecInPipe(name string, args ...string) (res []byte)
func (*CommandConfig88Omit) StreamExec ¶ added in v0.0.10
func (T *CommandConfig88Omit) StreamExec(name string, args ...string) (res []byte)
func (*CommandConfig88Omit) WithBash ¶ added in v0.0.6
func (T *CommandConfig88Omit) WithBash() (res *CommandConfig)
func (*CommandConfig88Omit) WithDebug ¶ added in v0.0.16
func (T *CommandConfig88Omit) WithDebug() (res *CommandConfig)
func (*CommandConfig88Omit) WithDebugMode ¶ added in v0.0.6
func (T *CommandConfig88Omit) WithDebugMode(debugMode bool) (res *CommandConfig)
func (*CommandConfig88Omit) WithEnvs ¶ added in v0.0.6
func (T *CommandConfig88Omit) WithEnvs(envs []string) (res *CommandConfig)
func (*CommandConfig88Omit) WithMatchMore ¶ added in v0.0.16
func (T *CommandConfig88Omit) WithMatchMore(matchMore bool) (res *CommandConfig)
func (*CommandConfig88Omit) WithMatchPipe ¶ added in v0.0.16
func (T *CommandConfig88Omit) WithMatchPipe(matchPipe func(line string) bool) (res *CommandConfig)
func (*CommandConfig88Omit) WithPath ¶ added in v0.0.6
func (T *CommandConfig88Omit) WithPath(path string) (res *CommandConfig)
func (*CommandConfig88Omit) WithSh ¶ added in v0.0.6
func (T *CommandConfig88Omit) WithSh() (res *CommandConfig)
func (*CommandConfig88Omit) WithShell ¶ added in v0.0.6
func (T *CommandConfig88Omit) WithShell(shellType string, shellFlag string) (res *CommandConfig)
func (*CommandConfig88Omit) WithShellFlag ¶ added in v0.0.6
func (T *CommandConfig88Omit) WithShellFlag(shellFlag string) (res *CommandConfig)
func (*CommandConfig88Omit) WithShellType ¶ added in v0.0.6
func (T *CommandConfig88Omit) WithShellType(shellType string) (res *CommandConfig)
func (*CommandConfig88Omit) WithZsh ¶ added in v0.0.6
func (T *CommandConfig88Omit) WithZsh() (res *CommandConfig)
type CommandConfig88Soft ¶ added in v0.0.6
type CommandConfig88Soft struct {
// contains filtered or unexported fields
}
func (*CommandConfig88Soft) Exec ¶ added in v0.0.6
func (T *CommandConfig88Soft) Exec(name string, args ...string) (res []byte)
func (*CommandConfig88Soft) ExecInPipe ¶ added in v0.0.16
func (T *CommandConfig88Soft) ExecInPipe(name string, args ...string) (res []byte)
func (*CommandConfig88Soft) StreamExec ¶ added in v0.0.10
func (T *CommandConfig88Soft) StreamExec(name string, args ...string) (res []byte)
func (*CommandConfig88Soft) WithBash ¶ added in v0.0.6
func (T *CommandConfig88Soft) WithBash() (res *CommandConfig)
func (*CommandConfig88Soft) WithDebug ¶ added in v0.0.16
func (T *CommandConfig88Soft) WithDebug() (res *CommandConfig)
func (*CommandConfig88Soft) WithDebugMode ¶ added in v0.0.6
func (T *CommandConfig88Soft) WithDebugMode(debugMode bool) (res *CommandConfig)
func (*CommandConfig88Soft) WithEnvs ¶ added in v0.0.6
func (T *CommandConfig88Soft) WithEnvs(envs []string) (res *CommandConfig)
func (*CommandConfig88Soft) WithMatchMore ¶ added in v0.0.16
func (T *CommandConfig88Soft) WithMatchMore(matchMore bool) (res *CommandConfig)
func (*CommandConfig88Soft) WithMatchPipe ¶ added in v0.0.16
func (T *CommandConfig88Soft) WithMatchPipe(matchPipe func(line string) bool) (res *CommandConfig)
func (*CommandConfig88Soft) WithPath ¶ added in v0.0.6
func (T *CommandConfig88Soft) WithPath(path string) (res *CommandConfig)
func (*CommandConfig88Soft) WithSh ¶ added in v0.0.6
func (T *CommandConfig88Soft) WithSh() (res *CommandConfig)
func (*CommandConfig88Soft) WithShell ¶ added in v0.0.6
func (T *CommandConfig88Soft) WithShell(shellType string, shellFlag string) (res *CommandConfig)
func (*CommandConfig88Soft) WithShellFlag ¶ added in v0.0.6
func (T *CommandConfig88Soft) WithShellFlag(shellFlag string) (res *CommandConfig)
func (*CommandConfig88Soft) WithShellType ¶ added in v0.0.6
func (T *CommandConfig88Soft) WithShellType(shellType string) (res *CommandConfig)
func (*CommandConfig88Soft) WithZsh ¶ added in v0.0.6
func (T *CommandConfig88Soft) WithZsh() (res *CommandConfig)
type OsCommand ¶ added in v0.0.9
type OsCommand = CommandConfig
func NewOsCommand ¶ added in v0.0.9
func NewOsCommand() *OsCommand