cli

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2022 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCmd

func NewCmd(streams genericclioptions.IOStreams, name string) *cobra.Command

NewCmd returns a new initialized command.

Types

type CommandOptions

type CommandOptions struct {
	Flags         *Flags
	Client        client.Interface
	ClientFlags   *client.Flags
	Namespace     string
	ResourceNames []string

	genericclioptions.IOStreams
}

CommandOptions represents the options of the command.

func (*CommandOptions) Complete

func (co *CommandOptions) Complete(_ *cobra.Command, _ []string) error

Complete finishes the setup of the command options.

func (*CommandOptions) Execute

func (co *CommandOptions) Execute() error

Execute runs the command.

func (*CommandOptions) Run

func (co *CommandOptions) Run(c *cobra.Command, args []string)

Run is the method called by cobra to run the command.

func (*CommandOptions) Validate

func (co *CommandOptions) Validate(_ *cobra.Command, args []string) error

Validate ensure that required options to run the command are set and valid.

type Flags

type Flags struct {
	AllNamespaces      bool
	ShowNamespace      bool
	ShowKind           bool
	ShowContainers     bool
	ShowStats          bool
	NoColors           bool
	NoHeaders          bool
	SortOrder          sortOrder
	SortColumns        []string
	LabelSelector      string
	FieldSelector      string
	Output             string
	RecommendationType vpa.RecommendationType
	WarningThreshold   float64
	CriticalThreshold  float64
	// contains filtered or unexported fields
}

Flags represents the common command flags.

func DefaultFlags

func DefaultFlags() *Flags

DefaultFlags returns default command flags.

func (*Flags) AddFlags

func (f *Flags) AddFlags(flags *pflag.FlagSet)

AddFlags binds the command flags to the given pflag.FlagSet.

func (*Flags) Tidy added in v0.4.0

func (f *Flags) Tidy() error

Tidy post-processes the flags.

Jump to

Keyboard shortcuts

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