cli

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2025 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommandGroupInfo       = "Info"
	CommandGroupKubesel    = "Kubesel"
	CommandGroupKubeconfig = "Kubeconfig"
)
View Source
const (
	ExitCodeOK        = 0
	ExitCodeError     = 1
	ExitCodeHelp      = 10
	ExitCodeCancelled = 130
)

Variables

View Source
var (
	// Kubesel is the global instance of [kubesel.Kubesel] used by all
	// subcommands.
	Kubesel = sync.OnceValues(kubesel.NewKubesel)

	// Kubectl is the global instance of the [kubectl.Kubectl] wrapper used by
	// all subcommands.
	Kubectl = sync.OnceValues(kubectl.NewKubectlFromPATH)
)
View Source
var (
	ErrUnknownFormat      = errors.New("unknown output format")
	ErrFormatNoOptions    = errors.New("format does not take options")
	ErrFormatNeedsOptions = errors.New("format requires options")
)
View Source
var ClusterCommandOptions struct {
}
View Source
var ContextCommandOptions struct {
	KeepNamespace bool
}
View Source
var GCCommandOptions struct {
}
View Source
var GlobalOptions struct {
	Debug       bool // --debug (hidden flag)
	Color       bool // --color
	OutputIsTTY bool // not a flag
}
View Source
var InitCommandOptions struct {
	KubeconfigFiles []string
}
View Source
var ListCommandOptions struct {
	OutputFormat OutputFormat
}
View Source
var NamespaceCommandOptions struct {
}
View Source
var RootCommand = cobra.Command{
	Use: filepath.Base(os.Args[0]),

	CompletionOptions: cobra.CompletionOptions{
		HiddenDefaultCmd: initScriptLoadsCompletions,
	},

	SilenceErrors: true,
	SilenceUsage:  true,
}

RootCommand is the root `kubesel` command.

View Source
var UserCommandOptions struct {
}

Functions

func DetectTerminal

func DetectTerminal()

DetectTerminalColors changes the default values for some options depending on whether kubsel is writing its output to a terminal.

func Run

func Run(args []string) (int, error)

Run is the entrypoint for the kubesel command-line interface.

func UseColumnOutput

func UseColumnOutput(opts string, target *OutputFormat) error

UseColumnOutput updates the OutputFormat to display items in columns.

func UseListOutput

func UseListOutput(opts string, target *OutputFormat) error

UseListOutput updates the OutputFormat to display items in a list.

func UseTableOutput

func UseTableOutput(opts string, target *OutputFormat) error

UseTableOutput updates the OutputFormat to display items in a table.

Types

type OutputFormat

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

OutputFormat is the flag used by `kubesel list`.

func (*OutputFormat) DefaultIfUnset

func (f *OutputFormat) DefaultIfUnset()

func (*OutputFormat) Set

func (f *OutputFormat) Set(v string) error

Set implements pflag.Value.

func (*OutputFormat) String

func (f *OutputFormat) String() string

String implements pflag.Value.

func (*OutputFormat) Type

func (f *OutputFormat) Type() string

Type implements pflag.Value.

Jump to

Keyboard shortcuts

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