Documentation ¶
Index ¶
- func ShouldAddSuggest(command, suggest string) (string, bool)
- func SuggestSubCommand(command string, namespaces client.NamespaceNames, contexts []string) []string
- func ToLabels(s string) map[string]string
- type Interpreter
- func (c *Interpreter) Amend(c1 *Interpreter)
- func (c *Interpreter) Cmd() string
- func (c *Interpreter) ContextArg() (string, bool)
- func (c *Interpreter) CowArg() (string, bool)
- func (c *Interpreter) DirArg() (string, bool)
- func (c *Interpreter) FilterArg() (string, bool)
- func (c *Interpreter) FuzzyArg() (string, bool)
- func (c *Interpreter) GetLine() string
- func (c *Interpreter) HasContext() (string, bool)
- func (c *Interpreter) HasNS() bool
- func (c *Interpreter) IsAliasCmd() bool
- func (c *Interpreter) IsBailCmd() bool
- func (c *Interpreter) IsBlank() bool
- func (c *Interpreter) IsContextCmd() bool
- func (c *Interpreter) IsCowCmd() bool
- func (c *Interpreter) IsDirCmd() bool
- func (c *Interpreter) IsHelpCmd() bool
- func (c *Interpreter) IsRBACCmd() bool
- func (c *Interpreter) IsXrayCmd() bool
- func (c *Interpreter) LabelsArg() (map[string]string, bool)
- func (c *Interpreter) NSArg() (string, bool)
- func (c *Interpreter) RBACArgs() (string, string, bool)
- func (c *Interpreter) Reset(s string) *Interpreter
- func (c *Interpreter) ResetContextArg()
- func (c *Interpreter) XrayArgs() (string, string, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ShouldAddSuggest ¶
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.
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) 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) 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.