Documentation
¶
Overview ¶
Package cobraext provides extensions and utilities for the Cobra CLI framework.
Package cobraext extends the cobra command-line framework. Provides utilities to enhance cobra's functionality, particularly for handling unknown subcommands when TraverseChildren is enabled. Includes functions for error reporting and command suggestions that work alongside cobra's built-in features.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetFlagIfNotSet ¶ added in v0.0.13
SetFlagIfNotSet sets a flag's value only if it has not been set yet.
func UnknownSubcommandAction ¶
UnknownSubcommandAction handles unknown cobra subcommands. Implements cobra.Command.RunE to provide helpful error messages and suggestions when an unknown subcommand is used. Required when TraverseChildren is true, as this disables cobra's built-in suggestion system. See: - https://github.com/spf13/cobra/issues/981 - https://github.com/containerd/nerdctl/blob/242e6fc6e861b61b878bd7df8bf25e95674c036d/cmd/nerdctl/main.go#L401-L418
Types ¶
This section is empty.