Documentation
¶
Overview ¶
Package commandrunner provides helpers for executing Cobra commands while capturing their output and translating k3d logging semantics.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MergeCommandError ¶
func MergeCommandError(base error, res CommandResult) error
MergeCommandError enriches a base error with captured stdout/stderr when available.
Types ¶
type CobraCommandRunner ¶
type CobraCommandRunner struct{}
CobraCommandRunner executes Cobra commands while mirroring k3d logging semantics.
func NewCobraCommandRunner ¶
func NewCobraCommandRunner() *CobraCommandRunner
NewCobraCommandRunner creates a command runner that wraps Cobra execution with stdout/stderr capture compatible with k3d's logging behavior.
func (*CobraCommandRunner) Run ¶
func (r *CobraCommandRunner) Run( ctx context.Context, cmd *cobra.Command, args []string, ) (CommandResult, error)
Run executes the provided Cobra command while capturing stdout/stderr.
type CommandResult ¶
CommandResult captures the stdout and stderr collected during a Cobra command execution.
type CommandRunner ¶
type CommandRunner interface {
Run(ctx context.Context, cmd *cobra.Command, args []string) (CommandResult, error)
}
CommandRunner executes Cobra commands while capturing their output.