prerun

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitClient added in v0.15.1

func InitClient(p common.Params, cmd *cobra.Command) (*client.RESTClient, error)

InitClient initializes the REST client for the command based on direct connection flags or kubeconfig.

Parameters:

  • p: common.Params containing configuration parameters.
  • cmd: The cobra.Command being executed.

Returns:

  • *client.RESTClient: The initialized REST client.
  • error: An error if client initialization fails.

func PersistentPreRunE

func PersistentPreRunE(p common.Params) func(*cobra.Command, []string) error

PersistentPreRunE returns a function that can be used as a persistent pre-run function for Cobra commands. It initializes the provided parameters using the flags defined in the command.

Parameters:

  • p: A common.Params struct that will be initialized with values from command flags.

Returns:

  • A function that takes a *cobra.Command and a []string, and returns an error. This function initializes the params using flags.InitParams and returns any error encountered.

Types

This section is empty.

Jump to

Keyboard shortcuts

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