Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HistoryItem ¶
type HistoryItem struct { // The text displayed by the hint. Text string // The history time. Used as priority when sorting hints. Time int }
HistoryItem represents a history entry.
type HistoryTrie ¶
type HistoryTrie struct { *patricia.Trie // Path to the history file. Path string // List of hints. Hints []HistoryItem NavigationArray []HistoryItem Navigating bool NavigationIndex int // The offset at which the user provided prefix ends. Must // be less than the length of the visible hint text. CurrentHintTextOffset int // The visible hint text. CurrentHintText string }
func (*HistoryTrie) GoToNextEntry ¶
func (h *HistoryTrie) GoToNextEntry() string
Go to the next history entry and return selected text.
func (*HistoryTrie) GoToPrevEntry ¶
func (h *HistoryTrie) GoToPrevEntry() string
Go to the previous history entry and return selected text.
func (*HistoryTrie) Load ¶
func (h *HistoryTrie) Load(merge bool) error
Load history optionally merging it with the existing trie.
func (*HistoryTrie) Push ¶
func (h *HistoryTrie) Push(prefix patricia.Prefix)
Append a line to history.
func (*HistoryTrie) StartNavigation ¶
func (h *HistoryTrie) StartNavigation()
Start history navigation.
type Repl ¶
type Repl struct { History HistoryTrie Runner func(args []string) error Suggester Suggester // contains filtered or unexported fields }
Read-print-loop manager.
type Suggester ¶
type Suggester struct {
Suggestions []*Suggestion
}
Suggester can perform auto-completion.
func (*Suggester) Create ¶
func (suggester *Suggester) Create(s string) *Suggestion
Create a new root suggestion item.
type Suggestion ¶
type Suggestion struct { Prefix string // contains filtered or unexported fields }
Suggestion represents a command-level suggestion which can possess children.
func (*Suggestion) AddChild ¶
func (suggestion *Suggestion) AddChild(value string)
Add a new suggestion string.
Click to show internal directories.
Click to hide internal directories.