runner

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Runner execute the sub-command lifecycle, wrapper around sub-commands.

func NewRunner

func NewRunner(params *params.Params, ioStreams *genericclioptions.IOStreams, subCmd SubCommand) *Runner

NewRunner instantiate a Runner.

func (*Runner) Cmd

func (r *Runner) Cmd() *cobra.Command

Cmd is a wrapper around sub-command's Cobra, it wires up global flags and set a single RunE executor to self.

func (*Runner) RunE

func (r *Runner) RunE(_ *cobra.Command, args []string) error

RunE cobra.Command's RunE implementation focusing on sub-commands lifecycle. To achieve it, a dynamic client and configured namespace are informed.

type SubCommand

type SubCommand interface {
	// Cmd shares the cobra.Command instance.
	Cmd() *cobra.Command
	// Complete aggregate data needed for the sub-command primary logic.
	Complete(params *params.Params, ioStreams *genericclioptions.IOStreams, args []string) error
	// Validate perform validation against the context collected.
	Validate() error
	// Run execute the primary sub-command logic.
	Run(params *params.Params, ioStreams *genericclioptions.IOStreams) error
}

SubCommand defines the methods for a sub-command wrapped with Runner.

Jump to

Keyboard shortcuts

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