Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CobraLambda ¶
type CobraLambda struct {
// contains filtered or unexported fields
}
func NewCobraLambda ¶
func NewCobraLambda(ctx context.Context, cmd *cobra.Command) *CobraLambda
func (*CobraLambda) Execute ¶
func (w *CobraLambda) Execute(args []string) (*OutputCapture, error)
Execute runs the Cobra command with the given arguments and captures all output This method is thread-safe and will restore os.Stdout/Stderr even if the command panics Note: Only one execution can run at a time per wrapper instance to avoid interference
func (*CobraLambda) ExecuteContext ¶
func (w *CobraLambda) ExecuteContext(ctx context.Context, args []string) (*OutputCapture, error)
ExecuteWithContext is a convenience method that runs Execute with the provided context overriding context passed in from NewCobraLambda and restoring to original context after execution
type OutputCapture ¶
type OutputCapture struct {
Output string
}
OutputCapture holds captured output from both Cobra command and os.Stdout/Stderr
Click to show internal directories.
Click to hide internal directories.