Documentation
¶
Index ¶
- type Option
- func WithArgs(args ...string) Option
- func WithArgsString(argsStr string) Option
- func WithCombinedOutput() Option
- func WithDir(dir string) Option
- func WithDiscard() Option
- func WithEcho(enable bool) Option
- func WithEchoWriter(w io.Writer) Option
- func WithEnv(env []string) Option
- func WithPassthrough() Option
- func WithStdin(r io.Reader) Option
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*options)
Option is a functional option for configuring command execution.
func WithArgs ¶
WithArgs sets the arguments with varargs. No quoting or escaping is performed. The caller is responsible for any necessary quoting/escaping.
func WithArgsString ¶
WithArgsString sets the arguments from a string using shell-style parsing. The string is split using github.com/google/shlex which handles: - Whitespace splitting - Single and double quote handling - Escape sequences Example: WithArgsString(`-f "file name.txt" --mode=fast`)
func WithCombinedOutput ¶
func WithCombinedOutput() Option
WithCombinedOutput captures stdout and stderr together in Combined field.
func WithDiscard ¶
func WithDiscard() Option
WithDiscard sends stdout/stderr to io.Discard (but still captures).
func WithEchoWriter ¶
WithEchoWriter sets where to write the command echo (default: os.Stdout).
func WithPassthrough ¶
func WithPassthrough() Option
WithPassthrough sends stdout and stderr to os.Stdout AND captures them separately.