Documentation ¶
Index ¶
- func App(app Application)
- func Do(description command.Describer, plugger Plugger, ...)
- type Application
- type Plug
- func (p *Plug) Decorate(arg interface{})
- func (p *Plug) DecorateLn(arg interface{})
- func (p *Plug) Message(arg interface{})
- func (p *Plug) MessageFail(arg interface{})
- func (p *Plug) MessageGreen(arg interface{})
- func (p *Plug) MessageGreenLn(arg interface{})
- func (p *Plug) MessageLn(arg interface{})
- func (p *Plug) MessageRed(arg interface{})
- func (p *Plug) MessageRedLn(arg interface{})
- func (p *Plug) Output(arg interface{})
- func (p *Plug) PrintList(list runtime.Object, w io.Writer)
- func (p *Plug) ResourceVisitor(resources ...string) resource.Visitor
- type Plugger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Do ¶
func Do(description command.Describer, plugger Plugger, moreFlags ...command.CmdFlagger)
Do sets up everything for a Describer, Plugger and Flaggers, and parses the cobra command The plugger is then run with the setup Plug Use this method when you want separate components for part or want more than one flagger If your struct implements all interfaces in one place, use App()
Types ¶
type Application ¶
type Application interface { Plugger command.Describer command.CmdFlagger }
Application collects all the interface components needed to start an application as a kubectl plugin
type Plug ¶
type Plug struct { Client client.Client // Common flagsets ConfigFlags *genericclioptions.ConfigFlags PrintFlags *genericclioptions.PrintFlags ResourceFlags *genericclioptions.ResourceBuilderFlags // Current Printer and IO options Printer printers.ResourcePrinter IO genericclioptions.IOStreams // Color typesetter for the cli output CLI aurora.Aurora // Commonly used flags values Namespace string // Arguments remaining passed to the cli Args []string }
Plug is a wrapper around a k8s client, corbra, cli-runtime, and cli based IO that help make fully featured kubectl plugins a Plug will be setup and passed to a Plugger interface to use for application based logic
func (*Plug) Decorate ¶
func (p *Plug) Decorate(arg interface{})
Decorate runs Message only if attached to a CLI and adds the faint modifier
func (*Plug) DecorateLn ¶
func (p *Plug) DecorateLn(arg interface{})
DecorateLn runs MessageLn only if attached to a CLI and adds the faint modifier
func (*Plug) Message ¶
func (p *Plug) Message(arg interface{})
Message to outputs stderr. Used for cli output that could also be thought of as logs
func (*Plug) MessageFail ¶
func (p *Plug) MessageFail(arg interface{})
MessageFail outputs MessageLn to stderr and then os.Exit(1)
func (*Plug) MessageGreen ¶
func (p *Plug) MessageGreen(arg interface{})
MessageGreen outputs a green colored message
func (*Plug) MessageGreenLn ¶
func (p *Plug) MessageGreenLn(arg interface{})
MessageGreenLn outputs a green colored message with a new line appended
func (*Plug) MessageLn ¶
func (p *Plug) MessageLn(arg interface{})
MessageLn outputs to stderr with a new line appended. Used for cli output that could also be thought of as logs
func (*Plug) MessageRed ¶
func (p *Plug) MessageRed(arg interface{})
MessageRed outputs a red colored message
func (*Plug) MessageRedLn ¶
func (p *Plug) MessageRedLn(arg interface{})
MessageRedLn outputs a red colored message with a new line appended
func (*Plug) Output ¶
func (p *Plug) Output(arg interface{})
Output to stdout. Used for non message log lines (outputting yaml etc)