cmd

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

type Cmd struct {
	UIStopTimeout time.Duration
	// contains filtered or unexported fields
}

func NewCmd

func NewCmd(plugin Fetcher, stdout Stdout, stderr io.Writer, ui Starter) (*Cmd, error)

func (*Cmd) Run

func (c *Cmd) Run(ctx context.Context) error

type Fetcher

type Fetcher interface {
	Fetch(ctx context.Context) ([]string, error)
}

Fetcher is an interface for cmd.Plugin

type KubeClient

type KubeClient interface {
	ListApiResources(ctx context.Context, namespaced bool) ([]string, error)
	GetResources(ctx context.Context, kind string) ([]string, error)
}

KubeClient is an interface for kubectl.Kubectl

type Options

type Options struct {
	AllNamespaces        bool
	IncludeNonNamespaced bool
	MaxInFlight          int
	Pattern              *regexp.Regexp
}

Options contains the result of parsing the command line options

func GetOptions

func GetOptions(commandLineArgs []string) (*Options, error)

GetOptions returns a new Options populated with the parsed command line arguments provided by `commandLineArgs`. If `commandLineArgs` is nil, os.Args[1:] is used.

type Plugin

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

func NewPlugin

func NewPlugin(kubeClient KubeClient, options *Options, tui ProgressDisplayer) (*Plugin, error)

NewPlugin returns a new Plugin ready to be used

func (*Plugin) Fetch

func (p *Plugin) Fetch(ctx context.Context) ([]string, error)

type ProgressDisplayer

type ProgressDisplayer interface {
	SetTotalKinds(int) chan<- *terminal.GetResourcesUpdate
}

ProgressDisplayer is an interface for terminal.UI

type Starter

type Starter interface {
	Start(ctx context.Context, wg *sync.WaitGroup)
}

Starter is an interface for terminal.UI

type Stdout

type Stdout interface {
	io.Writer
	Stat() (fs.FileInfo, error)
}

Jump to

Keyboard shortcuts

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