Documentation
¶
Index ¶
- func EnsureRunnable(c *cobra.Command)
- func IsExecutionIntercepted(c *cobra.Command) bool
- func PrepareInterceptedExecution(c *cobra.Command)
- func RecursivelyWrapExecution(c *cobra.Command, interceptor ExecutionInterceptor)
- func RecursivelyWrapRun(c *cobra.Command)
- func RestoreInterceptedExecutions()
- type ExecutionInterceptor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureRunnable ¶ added in v0.17.0
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 PrepareInterceptedExecution ¶ added in v0.14.0
func RecursivelyWrapExecution ¶ added in v0.14.0
func RecursivelyWrapExecution(c *cobra.Command, interceptor ExecutionInterceptor)
func RecursivelyWrapRun ¶
func RestoreInterceptedExecutions ¶ added in v0.14.0
func RestoreInterceptedExecutions()