Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddResultsOptions ¶ added in v0.15.0
AddResultsOptions amends the provided command by adding flags required to initialize a cli.Param. It adds persistent flags for kubeconfig, context, namespace, host, token, API path, and TLS verification.
Parameters:
- cmd: A pointer to a cobra.Command to which the flags will be added.
This function does not return any value.
func AnyResultsFlagChanged ¶ added in v0.15.0
AnyResultsFlagChanged checks if any of the Results flags (host, token, api-path, insecure-skip-tls-verify) have been changed from their default values.
Parameters:
- cmd: A pointer to a cobra.Command to check the flags.
Returns:
- bool: true if any of the Results flags have been changed, false otherwise.
func InitParams ¶ added in v0.15.0
InitParams initializes cli.Params based on flags defined in the command.
This function retrieves flag values from the provided cobra.Command and sets the corresponding values in the common.Params object. It handles flags for kubeconfig, context, namespace, host, token, API path, and TLS verification.
Parameters:
- p: A common.Params object to be initialized with flag values.
- cmd: A *cobra.Command object containing the flags to be processed.
Returns:
- An error if any flag retrieval operation fails, nil otherwise.
Note: This function uses cmd.Flags() instead of cmd.PersistentFlags() to access flags, which may break symmetry with AddResultsOptions. This is because it could be a subcommand trying to access flags defined by the parent command.
Types ¶
type ResultsOptions ¶ added in v0.15.0
type ResultsOptions struct {
KubeConfig, Context, Namespace, Host, Token, APIPath string
InsecureSkipTLSVerify bool
}
ResultsOptions all global Results options
func GetResultsOptions ¶ added in v0.15.0
func GetResultsOptions(cmd *cobra.Command) ResultsOptions
GetResultsOptions retrieves the global Results Options that are not passed to subcommands. It extracts flag values from the provided command and returns them as a ResultsOptions struct.
Parameters:
- cmd: A pointer to a cobra.Command from which to retrieve flag values.
Returns:
- ResultsOptions: A struct containing the extracted flag values for kubeconfig, context, namespace, host, token, API path, and TLS verification settings.