Help us shape the future of Go! Take the 2026 Go Developer Survey

cli

package
v3.5.6 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 26 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddKubectlFlagsToCmd

func AddKubectlFlagsToCmd(cmd *cobra.Command) clientcmd.ClientConfig

AddKubectlFlagsToCmd adds kubectl like flags to a persistent flags of a command and returns the ClientConfig interface for retrieving the values.

func AddKubectlFlagsToSet

func AddKubectlFlagsToSet(flags *pflag.FlagSet) clientcmd.ClientConfig

AddKubectlFlagsToSet adds kubectl like flags to a provided flag set and returns the ClientConfig interface for retrieving the values.

func AskToProceed

func AskToProceed(message string) bool

AskToProceed prompts the user with a message (typically a yes or no question) and returns whether they responded in the affirmative or negative.

func AskToProceedS

func AskToProceedS(message string) string

AskToProceedS prompts the user with a message (typically a yes, no or all question) and returns string "a", "y" or "n".

func InteractiveEdit

func InteractiveEdit(filePattern string, data []byte, save func(input []byte) error)

InteractiveEdit launches an interactive editor

func NewVersionCmd

func NewVersionCmd(cliName string) *cobra.Command

NewVersionCmd returns a new `version` command to be used as a sub-command to root

func PrintDiff

func PrintDiff(name string, live *unstructured.Unstructured, target *unstructured.Unstructured) error

PrintDiff prints a diff between two unstructured objects to stdout using an external diff utility Honors the diff utility set in the KUBECTL_EXTERNAL_DIFF environment variable

func PromptCredentials

func PromptCredentials(username, password string) (string, string)

PromptCredentials is a helper to prompt the user for a username and password (unless already supplied)

func PromptMessage

func PromptMessage(message, value string) string

PromptMessage prompts the user for a value (unless already supplied)

func PromptPassword

func PromptPassword(password string) string

PromptPassword prompts the user for a password, without local echo (unless already supplied). If terminal.ReadPassword fails — often due to stdin not being a terminal (e.g., when input is piped), we fall back to reading from standard input using bufio.Reader.

func PromptUsername

func PromptUsername(username string) string

PromptUsername prompts the user for a username value

func ReadAndConfirmPassword

func ReadAndConfirmPassword(username string) (string, error)

ReadAndConfirmPassword is a helper to read and confirm a password from stdin

func SetGLogLevel

func SetGLogLevel(glogLevel int)

SetGLogLevel set the glog level for the k8s go-client

func SetLogFormat

func SetLogFormat(logFormat string)

SetLogFormat sets a logrus log format

func SetLogLevel

func SetLogLevel(logLevel string)

SetLogLevel parses and sets a logrus log level

Types

This section is empty.

Jump to

Keyboard shortcuts

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