Documentation ¶
Index ¶
- Constants
- Variables
- func NewExpBackOff(ctx context.Context, start, max time.Duration) backoff.BackOffContext
- func NormalizeVersion(version string) string
- func Truncate(str string, width int) string
- type BuffWatcher
- type BufferKind
- type Cluster
- type CmdBuff
- func (c *CmdBuff) Add(r rune)
- func (c *CmdBuff) AddListener(w BuffWatcher)
- func (c *CmdBuff) ClearText(fire bool)
- func (c *CmdBuff) Delete()
- func (c *CmdBuff) Empty() bool
- func (c *CmdBuff) GetSuggestion() string
- func (c *CmdBuff) GetText() string
- func (c *CmdBuff) InCmdMode() bool
- func (c *CmdBuff) IsActive() bool
- func (c *CmdBuff) RemoveListener(l BuffWatcher)
- func (c *CmdBuff) Reset()
- func (c *CmdBuff) SetActive(b bool)
- func (c *CmdBuff) SetText(text, suggestion string)
- type Commander
- type Component
- type Filterable
- type FishBuff
- func (f *FishBuff) Add(r rune)
- func (f *FishBuff) AutoSuggests() bool
- func (f *FishBuff) ClearSuggestions()
- func (f *FishBuff) CurrentSuggestion() (string, bool)
- func (f *FishBuff) Delete()
- func (f *FishBuff) NextSuggestion() (string, bool)
- func (f *FishBuff) Notify(delete bool)
- func (f *FishBuff) PrevSuggestion() (string, bool)
- func (f *FishBuff) SetSuggestionFn(fn SuggestionFunc)
- func (f *FishBuff) Suggestions() []string
- type Flash
- func (f *Flash) Channel() FlashChan
- func (f *Flash) Clear()
- func (f *Flash) Err(err error)
- func (f *Flash) Errf(fmat string, args ...interface{})
- func (f *Flash) Info(msg string)
- func (f *Flash) Infof(fmat string, args ...interface{})
- func (f *Flash) SetMessage(level FlashLevel, msg string)
- func (f *Flash) Warn(msg string)
- func (f *Flash) Warnf(fmat string, args ...interface{})
- type FlashChan
- type FlashLevel
- type FlashListener
- type Hint
- type HintListener
- type Hinter
- type History
- type Igniter
- type LevelMessage
- type MenuHint
- type MenuHints
- type MyTable
- func (t *MyTable) AddListener(l TableListener)
- func (t *MyTable) ClusterWide() bool
- func (t *MyTable) Count() int
- func (t *MyTable) Delete(ctx context.Context, path string, cascade, force bool) error
- func (t *MyTable) Empty() bool
- func (t *MyTable) GetNamespace() string
- func (t *MyTable) InNamespace(ns string) bool
- func (t *MyTable) Peek() render.TableData
- func (t *MyTable) Refresh(ctx context.Context) error
- func (t *MyTable) RemoveListener(l TableListener)
- func (t *MyTable) SendCommand(ctx context.Context, key int64) error
- func (t *MyTable) SetInstance(path string)
- func (t *MyTable) SetLabelFilter(f string)
- func (t *MyTable) SetNamespace(ns string)
- func (t *MyTable) SetRefreshRate(d time.Duration)
- func (t *MyTable) Watch(ctx context.Context) error
- type Primitive
- type Renderer
- type ResourceMeta
- type ResourceViewer
- type ResourceViewerListener
- type SemVer
- type SilentStack
- func (s *SilentStack) Clear()
- func (s *SilentStack) Dump()
- func (s *SilentStack) Empty() bool
- func (s *SilentStack) Flatten() []string
- func (s *SilentStack) IsLast() bool
- func (s *SilentStack) Peek() []Component
- func (s *SilentStack) Pop() (Component, bool)
- func (s *SilentStack) Previous() Component
- func (s *SilentStack) Push(c Component)
- func (s *SilentStack) Top() Component
- type Stack
- func (s *Stack) AddListener(l StackListener)
- func (s *Stack) Clear()
- func (s *Stack) Dump()
- func (s *Stack) Empty() bool
- func (s *Stack) Flatten() []string
- func (s *Stack) IsLast() bool
- func (s *Stack) Peek() []Component
- func (s *Stack) Pop() (Component, bool)
- func (s *Stack) Previous() Component
- func (s *Stack) Push(c Component)
- func (s *Stack) RemoveListener(l StackListener)
- func (s *Stack) Top() Component
- type StackAction
- type StackEvent
- type StackListener
- type SuggestionFunc
- type SuggestionListener
- type TableListener
- type Text
- type TextListener
- type Textable
- type TreeRenderer
- type ViewerToggleOpts
Constants ¶
const ( REFRESH int64 = 1 MAIL int64 = 2 )
const MaxHistory = 20
MaxHistory tracks max command history.
Variables ¶
var Registry = map[string]ResourceMeta{ "process": { Renderer: &render.Process{}, }, "namespace": { Renderer: &render.Namespace{}, }, }
Registry tracks resources metadata.
Functions ¶
func NewExpBackOff ¶
NewExpBackOff returns a new exponential backoff timer.
func NormalizeVersion ¶
NormalizeVersion ensures the version starts with a v.
Types ¶
type BuffWatcher ¶
type BuffWatcher interface { // BufferCompleted indicates input was accepted. BufferCompleted(text, suggestion string) // BufferChanged indicates the buffer was changed. BufferChanged(text, suggestion string) // BufferActive indicates the buff activity changed. BufferActive(state bool, kind BufferKind) }
BuffWatcher represents a command buffer listener.
type BufferKind ¶
type BufferKind int8
BufferKind indicates a buffer type.
const ( // CommandBuffer represents a command buffer. CommandBuffer BufferKind = 1 << iota // FilterBuffer represents a filter buffer. FilterBuffer )
type CmdBuff ¶
type CmdBuff struct {
// contains filtered or unexported fields
}
CmdBuff represents user command input.
func NewCmdBuff ¶
func NewCmdBuff(key rune, kind BufferKind) *CmdBuff
NewCmdBuff returns a new command buffer.
func (*CmdBuff) AddListener ¶
func (c *CmdBuff) AddListener(w BuffWatcher)
AddListener registers a cmd buffer listener.
func (*CmdBuff) Delete ¶
func (c *CmdBuff) Delete()
Delete removes the last character from the buffer.
func (*CmdBuff) GetSuggestion ¶
GetSuggestion returns the current suggestion.
func (*CmdBuff) RemoveListener ¶
func (c *CmdBuff) RemoveListener(l BuffWatcher)
RemoveListener removes a listener.
func (*CmdBuff) Reset ¶
func (c *CmdBuff) Reset()
Reset clears out the command buffer and deactivates it.
type Commander ¶
type Commander interface { // InCmdMode checks if prompt is active. InCmdMode() bool }
Commander tracks prompt status.
type Filterable ¶
type Filterable interface { Filter(string) ClearFilter() }
Filterable represents an entity that can be filtered.
type FishBuff ¶
type FishBuff struct { *CmdBuff // contains filtered or unexported fields }
FishBuff represents a suggestion buffer.
func NewFishBuff ¶
func NewFishBuff(key rune, kind BufferKind) *FishBuff
NewFishBuff returns a new command buffer.
func (*FishBuff) AutoSuggests ¶
AutoSuggests returns true if model implements auto suggestions.
func (*FishBuff) ClearSuggestions ¶
func (f *FishBuff) ClearSuggestions()
ClearSuggestions clear out all suggestions.
func (*FishBuff) CurrentSuggestion ¶
CurrentSuggestion returns the current suggestion.
func (*FishBuff) Delete ¶
func (f *FishBuff) Delete()
Delete removes the last character from the buffer.
func (*FishBuff) NextSuggestion ¶
NextSuggestion returns the next suggestion.
func (*FishBuff) PrevSuggestion ¶
PrevSuggestion returns the prev suggestion.
func (*FishBuff) SetSuggestionFn ¶
func (f *FishBuff) SetSuggestionFn(fn SuggestionFunc)
SetSuggestionFn sets up suggestions.
func (*FishBuff) Suggestions ¶
Suggestions returns suggestions.
type Flash ¶
type Flash struct {
// contains filtered or unexported fields
}
Flash represents a flash message model.
func (*Flash) SetMessage ¶
func (f *Flash) SetMessage(level FlashLevel, msg string)
SetMessage sets the flash level message.
type FlashLevel ¶
type FlashLevel int
FlashLevel represents flash message severity.
const ( // DefaultFlashDelay sets the flash clear delay. DefaultFlashDelay = 3 * time.Second // FlashInfo represents an info message. FlashInfo FlashLevel = iota // FlashWarn represents an warning message. FlashWarn // FlashErr represents an error message. FlashErr )
type FlashListener ¶
type FlashListener interface { // FlashChanged notifies the model changed. FlashChanged(FlashLevel, string) // FlashCleared notifies when the filter changed. FlashCleared() }
FlashListener represents a text model listener.
type Hint ¶
type Hint struct {
// contains filtered or unexported fields
}
Hint represent a hint model.
func (*Hint) AddListener ¶
func (h *Hint) AddListener(l HintListener)
AddListener adds a hint listener.
func (*Hint) RemoveListener ¶
func (h *Hint) RemoveListener(l HintListener)
RemoveListener deletes a listener.
type HintListener ¶
type HintListener interface {
HintsChanged(MenuHints)
}
HintListener represents a menu hints listener.
type Hinter ¶
type Hinter interface { // Hints returns a collection of menu hints. Hints() MenuHints // ExtraHints returns additional hints. ExtraHints() map[string]string }
Hinter represent a menu mnemonic provider.
type History ¶
type History struct {
// contains filtered or unexported fields
}
History represents a command history.
type Igniter ¶
type Igniter interface { Init(ctx context.Context) error // Start starts a component. Start() // Stop terminates a component. Stop() }
Igniter represents a runnable view.
type LevelMessage ¶
type LevelMessage struct { Level FlashLevel Text string }
LevelMessage tracks an message and severity.
func (LevelMessage) IsClear ¶
func (l LevelMessage) IsClear() bool
IsClear returns true if message is empty.
type MenuHint ¶
MenuHint represents keyboard mnemonic.
type MenuHints ¶
type MenuHints []MenuHint
MenuHints represents a collection of hints.
type MyTable ¶
type MyTable struct {
// contains filtered or unexported fields
}
MyTable represents a table model.
func (*MyTable) AddListener ¶
func (t *MyTable) AddListener(l TableListener)
AddListener adds a new model listener.
func (*MyTable) ClusterWide ¶
ClusterWide checks if resource is scope for all namespaces.
func (*MyTable) GetNamespace ¶
GetNamespace returns the model namespace.
func (*MyTable) InNamespace ¶
InNamespace checks if current namespace matches desired namespace.
func (*MyTable) RemoveListener ¶
func (t *MyTable) RemoveListener(l TableListener)
RemoveListener delete a listener from the list.
func (*MyTable) SetInstance ¶
SetInstance sets a single entry table.
func (*MyTable) SetLabelFilter ¶
SetLabelFilter sets the labels filter.
func (*MyTable) SetNamespace ¶
SetNamespace sets up model namespace.
func (*MyTable) SetRefreshRate ¶
SetRefreshRate sets model refresh duration.
type Renderer ¶
type Renderer interface { // IsGeneric identifies a generic handler. IsGeneric() bool // Render converts raw resources to tabular data. Render(o interface{}, ns string, rows *render.Rows) error // Header returns the resource header. Header(ns string) render.Header // ColorerFunc returns a row colorer function. ColorerFunc() render.ColorerFunc }
Renderer represents a resource renderer.
type ResourceMeta ¶
type ResourceMeta struct { //DAO dao.Accessor Renderer Renderer TreeRenderer TreeRenderer }
ResourceMeta represents model info about a resource.
type ResourceViewer ¶
type ResourceViewer interface { GetPath() string Filter(string) ClearFilter() Peek() []string SetOptions(context.Context, ViewerToggleOpts) Watch(context.Context) error Refresh(context.Context) error AddListener(ResourceViewerListener) RemoveListener(ResourceViewerListener) }
ResourceViewer represents a viewed resource.
type ResourceViewerListener ¶
type ResourceViewerListener interface { ResourceChanged(lines []string, matches fuzzy.Matches) ResourceFailed(error) }
ResourceViewerListener listens to viewing resource events.
type SemVer ¶
type SemVer struct {
Major, Minor, Patch int
}
SemVer represents a semantic version.
type SilentStack ¶
type SilentStack struct {
// contains filtered or unexported fields
}
SilentStack represents a stacks of components.
func NewSilentStack ¶
func NewSilentStack() *SilentStack
NewSilentStack returns a new initialized stack.
func (*SilentStack) Empty ¶
func (s *SilentStack) Empty() bool
Empty returns true if the stack is empty.
func (*SilentStack) Flatten ¶
func (s *SilentStack) Flatten() []string
Flatten returns a string representation of the component stack.
func (*SilentStack) IsLast ¶
func (s *SilentStack) IsLast() bool
IsLast indicates if stack only has one item left.
func (*SilentStack) Pop ¶
func (s *SilentStack) Pop() (Component, bool)
Pop removed the top item and returns it.
func (*SilentStack) Previous ¶
func (s *SilentStack) Previous() Component
Previous returns the previous component if any.
func (*SilentStack) Top ¶
func (s *SilentStack) Top() Component
Top returns the top most item or nil if the stack is empty.
type Stack ¶
type Stack struct {
// contains filtered or unexported fields
}
Stack represents a stacks of components.
func (*Stack) AddListener ¶
func (s *Stack) AddListener(l StackListener)
AddListener registers a stack listener.
func (*Stack) RemoveListener ¶
func (s *Stack) RemoveListener(l StackListener)
RemoveListener removes a listener.
type StackAction ¶
type StackAction int
StackAction represents an action on the stack.
const ( // StackPush denotes an add on the stack. StackPush StackAction = 1 << iota // StackPop denotes a delete on the stack. StackPop )
type StackEvent ¶
type StackEvent struct { // Kind represents the event condition. Action StackAction // Item represents the targeted item. Component Component }
StackEvent represents an operation on a view stack.
type StackListener ¶
type StackListener interface { // StackPushed indicates a new item was added. StackPushed(Component) // StackPopped indicates an item was deleted StackPopped(old, new Component) // StackTop indicates the top of the stack StackTop(Component) }
StackListener represents a stack listener.
type SuggestionFunc ¶
type SuggestionFunc func(text string) sort.StringSlice
SuggestionFunc produces suggestions.
type SuggestionListener ¶
type SuggestionListener interface { BuffWatcher // SuggestionChanged notifies suggestion changes. SuggestionChanged(text, sugg string) }
SuggestionListener listens for suggestions.
type TableListener ¶
type TableListener interface { // TableDataChanged notifies the model data changed. TableDataChanged(render.TableData) // TableLoadFailed notifies the load failed. TableLoadFailed(error) }
TableListener represents a table model listener.
type Text ¶
type Text struct {
// contains filtered or unexported fields
}
Text represents a text model.
func (*Text) AddListener ¶
func (t *Text) AddListener(listener TextListener)
AddListener adds a new model listener.
func (*Text) RemoveListener ¶
func (t *Text) RemoveListener(listener TextListener)
RemoveListener delete a listener from the list.
type TextListener ¶
type TextListener interface { // TextChanged notifies the model changed. TextChanged([]string) // TextFiltered notifies when the filter changed. TextFiltered([]string, fuzzy.Matches) }
TextListener represents a text model listener.
type Textable ¶
type Textable interface { Peek() []string SetText(string) AddListener(TextListener) RemoveListener(TextListener) }
Textable represents a text resource.
type TreeRenderer ¶
TreeRenderer represents an xray node.
type ViewerToggleOpts ¶
ViewerToggleOpts represents a collection of viewing options.