Documentation
¶
Index ¶
- func RunQuiet(ctx context.Context, name string, args ...string) error
- func SetDefaultLogger(l Logger)
- type Cmd
- func (c *Cmd) CombinedOutput() ([]byte, error)
- func (c *Cmd) Output() ([]byte, error)
- func (c *Cmd) Run() error
- func (c *Cmd) WithDir(dir string) *Cmd
- func (c *Cmd) WithEnv(env []string) *Cmd
- func (c *Cmd) WithLogger(l Logger) *Cmd
- func (c *Cmd) WithStderr(w io.Writer) *Cmd
- func (c *Cmd) WithStdin(r io.Reader) *Cmd
- func (c *Cmd) WithStdout(w io.Writer) *Cmd
- type Logger
- type NopLogger
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunQuiet ¶
RunQuiet executes the command suppressing stdout unless there is an error. Useful for internal commands.
func SetDefaultLogger ¶
func SetDefaultLogger(l Logger)
SetDefaultLogger sets the package-level default logger. Commands without an explicit logger will use this.
Types ¶
type Cmd ¶
type Cmd struct {
// contains filtered or unexported fields
}
Cmd represents a wrapped command
func (*Cmd) CombinedOutput ¶
CombinedOutput runs the command and returns its combined standard output and standard error.
func (*Cmd) Run ¶
Run executes the command and waits for it to finish. It automatically logs the command execution at debug level.
func (*Cmd) WithLogger ¶
WithLogger sets a custom logger for this command. If not set, the package default logger is used.
type Logger ¶
type Logger interface {
// Debug logs a debug-level message with optional key-value pairs.
Debug(msg string, keyvals ...any)
// Error logs an error-level message with optional key-value pairs.
Error(msg string, keyvals ...any)
}
Logger interface for command execution logging. Compatible with pkg/log.Logger and other structured loggers.