internalcmd

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureRunnable added in v0.17.0

func EnsureRunnable(c *cobra.Command)

EnsureRunnable sets a synthetic RunE on the command if it has no Run/RunE. This prevents cobra from short-circuiting to Help() before PreRunE fires, which is where execution interception (--jsonschema, --debug-options, etc.) happens. The synthetic RunE falls through to cmd.Help() so the user-visible behavior is unchanged.

The command is annotated with SyntheticRunAnnotation so the usage template can suppress the bare usage line (avoiding a misleading "app" line that implies the root is directly invocable).

Safe to call multiple times (idempotent). Subsequent Setup* calls and RecursivelyWrapExecution will wrap the synthetic RunE like any other.

func IsExecutionIntercepted added in v0.14.0

func IsExecutionIntercepted(c *cobra.Command) bool

func PrepareInterceptedExecution added in v0.14.0

func PrepareInterceptedExecution(c *cobra.Command)

func RecursivelyWrapExecution added in v0.14.0

func RecursivelyWrapExecution(c *cobra.Command, interceptor ExecutionInterceptor)

func RecursivelyWrapRun

func RecursivelyWrapRun(c *cobra.Command)

func RestoreInterceptedExecutions added in v0.14.0

func RestoreInterceptedExecutions()

Types

type ExecutionInterceptor added in v0.14.0

type ExecutionInterceptor struct {
	Annotation      string
	ShouldIntercept func(*cobra.Command) bool
	Intercept       func(*cobra.Command, []string) (bool, error)
}

Jump to

Keyboard shortcuts

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