cmd

package
v0.32.4 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0, Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ShouldAddSuggest

func ShouldAddSuggest(command, suggest string) (string, bool)

ShouldAddSuggest checks if a suggestion match the given command.

func SuggestSubCommand

func SuggestSubCommand(command string, namespaces client.NamespaceNames, contexts []string) []string

SuggestSubCommand suggests namespaces or contexts based on current command.

func ToLabels added in v0.30.1

func ToLabels(s string) map[string]string

Types

type Interpreter

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

Interpreter tracks user prompt input.

func NewInterpreter

func NewInterpreter(s string) *Interpreter

NewInterpreter returns a new instance.

func (*Interpreter) Amend

func (c *Interpreter) Amend(c1 *Interpreter)

Amend merges prompts.

func (*Interpreter) Cmd

func (c *Interpreter) Cmd() string

Cmd returns the command.

func (*Interpreter) ContextArg

func (c *Interpreter) ContextArg() (string, bool)

ContextArg returns context cmd arg.

func (*Interpreter) CowArg

func (c *Interpreter) CowArg() (string, bool)

CowArg returns the cow message.

func (*Interpreter) DirArg

func (c *Interpreter) DirArg() (string, bool)

DirArg returns the directory is present.

func (*Interpreter) FilterArg

func (c *Interpreter) FilterArg() (string, bool)

FilterArg returns the current filter if any.

func (*Interpreter) FuzzyArg added in v0.30.7

func (c *Interpreter) FuzzyArg() (string, bool)

FuzzyArg returns the fuzzy filter if any.

func (*Interpreter) GetLine

func (c *Interpreter) GetLine() string

GetLine teturns the prompt.

func (*Interpreter) HasContext

func (c *Interpreter) HasContext() (string, bool)

HasContext returns the current context if any.

func (*Interpreter) HasNS

func (c *Interpreter) HasNS() bool

HasNS returns true if ns is present in prompt.

func (*Interpreter) IsAliasCmd

func (c *Interpreter) IsAliasCmd() bool

IsAliasCmd returns true if alias cmd is detected.

func (*Interpreter) IsBailCmd

func (c *Interpreter) IsBailCmd() bool

IsBailCmd returns true if quit cmd is detected.

func (*Interpreter) IsBlank

func (c *Interpreter) IsBlank() bool

IsBlank returns true if prompt is empty.

func (*Interpreter) IsContextCmd

func (c *Interpreter) IsContextCmd() bool

IsContextCmd returns true if context cmd is detected.

func (*Interpreter) IsCowCmd

func (c *Interpreter) IsCowCmd() bool

IsCowCmd returns true if cow cmd is detected.

func (*Interpreter) IsDirCmd

func (c *Interpreter) IsDirCmd() bool

IsDirCmd returns true if dir cmd is detected.

func (*Interpreter) IsHelpCmd

func (c *Interpreter) IsHelpCmd() bool

IsHelpCmd returns true if help cmd is detected.

func (*Interpreter) IsRBACCmd

func (c *Interpreter) IsRBACCmd() bool

IsRBACCmd returns true if rbac cmd is detected.

func (*Interpreter) IsXrayCmd

func (c *Interpreter) IsXrayCmd() bool

IsXrayCmd returns true if xray cmd is detected.

func (*Interpreter) LabelsArg

func (c *Interpreter) LabelsArg() (map[string]string, bool)

LabelsArg return the labels map if any.

func (*Interpreter) NSArg

func (c *Interpreter) NSArg() (string, bool)

NSArg returns the current ns if any.

func (*Interpreter) RBACArgs

func (c *Interpreter) RBACArgs() (string, string, bool)

RBACArgs returns the subject and topic is any.

func (*Interpreter) Reset

func (c *Interpreter) Reset(s string) *Interpreter

Reset resets with new command.

func (*Interpreter) ResetContextArg

func (c *Interpreter) ResetContextArg()

ResetContextArg deletes context arg.

func (*Interpreter) XrayArgs

func (c *Interpreter) XrayArgs() (string, string, bool)

XRayArgs return the gvr and ns if any.

Jump to

Keyboard shortcuts

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