cmd

package
v0.33.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 64 Imported by: 59

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Command added in v0.23.16

func Command(name string, arg ...string) *exec.Cmd

func HandlePluginCommand added in v0.20.0

func HandlePluginCommand(pluginHandler PluginHandler, cmdArgs []string, minArgs int) error

HandlePluginCommand receives a pluginHandler and command-line arguments and attempts to find a plugin executable on the PATH that satisfies the given arguments.

func IsSubcommandPluginAllowed added in v0.28.0

func IsSubcommandPluginAllowed(foundCmd string) bool

IsSubcommandPluginAllowed returns the given command is allowed to use plugin as subcommand if the subcommand does not exist as builtin.

func NewCmdAlpha

func NewCmdAlpha(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

NewCmdAlpha creates a command that acts as an alternate root command for features in alpha

func NewDefaultKubectlCommand added in v0.20.0

func NewDefaultKubectlCommand() *cobra.Command

NewDefaultKubectlCommand creates the `kubectl` command with default arguments

func NewDefaultKubectlCommandWithArgs added in v0.20.0

func NewDefaultKubectlCommandWithArgs(o KubectlOptions) *cobra.Command

NewDefaultKubectlCommandWithArgs creates the `kubectl` command with arguments

func NewKubectlCommand added in v0.20.0

func NewKubectlCommand(o KubectlOptions) *cobra.Command

NewKubectlCommand creates the `kubectl` command and its nested children.

Types

type DefaultPluginHandler added in v0.20.0

type DefaultPluginHandler struct {
	ValidPrefixes []string
}

DefaultPluginHandler implements PluginHandler

func NewDefaultPluginHandler added in v0.20.0

func NewDefaultPluginHandler(validPrefixes []string) *DefaultPluginHandler

NewDefaultPluginHandler instantiates the DefaultPluginHandler with a list of given filename prefixes used to identify valid plugin filenames.

func (*DefaultPluginHandler) Execute added in v0.20.0

func (h *DefaultPluginHandler) Execute(executablePath string, cmdArgs, environment []string) error

Execute implements PluginHandler

func (*DefaultPluginHandler) Lookup added in v0.20.0

func (h *DefaultPluginHandler) Lookup(filename string) (string, bool)

Lookup implements PluginHandler

type KubectlOptions added in v0.23.0

type KubectlOptions struct {
	PluginHandler PluginHandler
	Arguments     []string
	ConfigFlags   *genericclioptions.ConfigFlags

	genericiooptions.IOStreams
}

type PluginHandler added in v0.20.0

type PluginHandler interface {
	// exists at the given filename, or a boolean false.
	// Lookup will iterate over a list of given prefixes
	// in order to recognize valid plugin filenames.
	// The first filepath to match a prefix is returned.
	Lookup(filename string) (string, bool)
	// Execute receives an executable's filepath, a slice
	// of arguments, and a slice of environment variables
	// to relay to the executable.
	Execute(executablePath string, cmdArgs, environment []string) error
}

PluginHandler is capable of parsing command line arguments and performing executable filename lookups to search for valid plugin files, and execute found plugins.

Directories

Path Synopsis
set
env
Package env provides functions to incorporate environment variables into set env.
Package env provides functions to incorporate environment variables into set env.
Package taints implements utilites for working with taints
Package taints implements utilites for working with taints

Jump to

Keyboard shortcuts

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