wrapper

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2025 License: MIT Imports: 7 Imported by: 0

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 NewCobraLambdaCLI added in v0.1.0

func NewCobraLambdaCLI(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 CobraLambdaEvent added in v0.1.0

type CobraLambdaEvent struct {
	Args []string `json:"args"`
}

func UnmarshalEvent added in v0.1.0

func UnmarshalEvent(eventJSON json.RawMessage) (*CobraLambdaEvent, error)

type CobraLambdaFunc added in v0.1.0

type CobraLambdaFunc func(ctx context.Context, event json.RawMessage) (any, error)

func NewCobrLambdaHandler added in v0.1.0

func NewCobrLambdaHandler(cmd *cobra.Command) CobraLambdaFunc

type OutputCapture

type OutputCapture struct {
	Stdout string `json:"stdout"`
}

OutputCapture holds captured output from both Cobra command and os.Stdout/Stderr

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL