Documentation
¶
Index ¶
- func ApplyOptions(cmd *cobra.Command, funcs []OptionsFunc)
- func Contains(a []string, s string) bool
- func ContainsSubstring(a []string, substring string) bool
- func GetFreePort() (int, error)
- func MarkFlagRequired(flaggish interface{}, name string) error
- func MustMarkFlagRequired(flaggish interface{}, name string)
- func MustMarkHidden(flags HideableFlag, name string)
- func MustMarkPersistentFlagRequired(cmd *cobra.Command, name string)
- func MustReplaceCmd(parent *cobra.Command, new *cobra.Command)
- func PortForward(namespace string, resource string, localPort string, kubePort string, ...) (*exec.Cmd, error)
- func PortForwardGet(ctx context.Context, namespace string, resource string, localPort string, ...) (string, *exec.Cmd, error)
- func Print(output, template string, m proto.Message, tblPrn Printer, w io.Writer) error
- func PrintJSON(m proto.Message, w io.Writer) error
- func PrintJSONList(data interface{}, w io.Writer) error
- func PrintList(output, template string, list interface{}, tblPrn Printer, w io.Writer) error
- func PrintTemplate(data interface{}, tmpl string, w io.Writer) error
- func PrintYAML(m proto.Message, w io.Writer) error
- func PrintYAMLList(data interface{}, w io.Writer) error
- func RandKubeNameBytes(n int) string
- func RandStringBytes(n int, basis string) string
- func ReplaceCmd(parent *cobra.Command, new *cobra.Command) error
- type CmdFunc
- type HideableFlag
- type Options
- type OptionsFunc
- type Printer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyOptions ¶
func ApplyOptions(cmd *cobra.Command, funcs []OptionsFunc)
func Contains ¶
func Contains(a []string, s string) bool
Contains indicates if a string slice 'a' contains the string s
func ContainsSubstring ¶
func ContainsSubstring(a []string, substring string) bool
Contains indicates if a string slice 'a' contains a string that encompases the string s
func GetFreePort ¶ added in v0.18.1
func GetFreePort() (int, error)
func MarkFlagRequired ¶ added in v0.23.0
func MarkFlagRequired(flaggish interface{}, name string) error
MarkFlagRequired returns an error if the call to MarkFlagRequired() fails.
func MustMarkFlagRequired ¶ added in v0.23.0
func MustMarkFlagRequired(flaggish interface{}, name string)
MustMarkFlagRequired panics if the call to MarkFlagRequired() fails.
func MustMarkHidden ¶ added in v0.23.0
func MustMarkHidden(flags HideableFlag, name string)
MustMarkHidden panics if the call to MarkHidden() fails.
func MustMarkPersistentFlagRequired ¶ added in v0.23.0
func MustMarkPersistentFlagRequired(cmd *cobra.Command, name string)
MustMarkPersistentFlagRequired panics if the call to MarkPersistentFlagRequired() fails.
func MustReplaceCmd ¶
func MustReplaceCmd(parent *cobra.Command, new *cobra.Command)
func PortForward ¶ added in v0.18.1
func PortForward(namespace string, resource string, localPort string, kubePort string, verbose bool) (*exec.Cmd, error)
Call kubectl port-forward. Callers are expected to clean up the returned portFwd *exec.cmd after the port-forward is no longer needed.
func PortForwardGet ¶ added in v0.18.1
func PortForwardGet(ctx context.Context, namespace string, resource string, localPort string, kubePort string, verbose bool, getPath string) (string, *exec.Cmd, error)
Call kubectl port-forward and make a GET request. Callers are expected to clean up the returned portFwd *exec.cmd after the port-forward is no longer needed.
func Print ¶
func Print(output, template string, m proto.Message, tblPrn Printer, w io.Writer) error
Print - prints the given proto.Message to io.Writer using the specified output format
func PrintJSON ¶
func PrintJSON(m proto.Message, w io.Writer) error
PrintJSON - prints the given proto.Message to io.Writer in JSON
func PrintJSONList ¶
func PrintJSONList(data interface{}, w io.Writer) error
PrintJSONList - prints the given list to io.Writer in JSON
func PrintList ¶
func PrintList(output, template string, list interface{}, tblPrn Printer, w io.Writer) error
PrintList - prints the given list of values to io.Writer using the specified output format
func PrintTemplate ¶
func PrintTemplate(data interface{}, tmpl string, w io.Writer) error
PrintTemplate prints the give value using the provided Go template to io.Writer
func PrintYAML ¶
func PrintYAML(m proto.Message, w io.Writer) error
PrintYAML - prints the given proto.Message to io.Writer in YAML
func PrintYAMLList ¶
func PrintYAMLList(data interface{}, w io.Writer) error
PrintYAMLList - prints the given list to io.Writer in YAML
func RandKubeNameBytes ¶
func RandKubeNameBytes(n int) string
RandDNS1035 generates a random string of length n that meets the DNS-1035 standard used by Kubernetes names
Typical kubernetes error message for invalid names: a DNS-1035 label must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character (e.g. 'my-name', or 'abc-123', regex used for validation is '[a-z]([-a-z0-9]*[a-z0-9])?')
func RandStringBytes ¶
func RandStringBytes(n int, basis string) string
RandStringBytes produces a random string of length n using the characters present in the basis string
func ReplaceCmd ¶
func ReplaceCmd(parent *cobra.Command, new *cobra.Command) error
Types ¶
type HideableFlag ¶ added in v0.23.0
type HideableFlag interface {
MarkHidden(string) error
}
type OptionsFunc ¶
type OptionsFunc = func(*cobra.Command)