Documentation ¶
Index ¶
- Variables
- type AutoCompleteFn
- type Candidate
- type Completions
- type Editor
- func (m *Editor) AddHistory(line string) error
- func (m *Editor) Close()
- func (m *Editor) GetLine() (string, error)
- func (m *Editor) LoadHistory(file string) error
- func (m *Editor) SaveHistory() error
- func (m *Editor) SetAutoSaveHistory(file string, autoSave bool)
- func (m *Editor) Update(imsg tea.Msg) (tea.Model, tea.Cmd)
- type Entry
- type Values
Constants ¶
This section is empty.
Variables ¶
var ErrInterrupted = editline.ErrInterrupted
ErrInterrupted is returned when the input was interrupted with e.g. Ctrl+C, or when SIGINT was received.
var ErrTerminated = errors.New("terminated")
ErrTerminated is returned when the input was interrupted by receiving SIGTERM.
Functions ¶
This section is empty.
Types ¶
type AutoCompleteFn ¶
type AutoCompleteFn = editline.AutoCompleteFn
AutoCompleteFn is called upon the user pressing the autocomplete key. The callback is provided the text of the input and the position of the cursor in the input. The returned msg is printed above the input box.
type Completions ¶
type Completions = editline.Completions
Completions is the return value of AutoCompleteFn. It is a combination of Values and a Candidate function that converts a display Entry into a replacement Candidate.
type Editor ¶
Editor represents an input line editor.
func (*Editor) AddHistory ¶
AddHistory adds a history entry and optionally saves the history to file.
func (*Editor) Close ¶
func (m *Editor) Close()
Close should be called when the editor is not used any more.
func (*Editor) LoadHistory ¶
LoadHistory loads the entry history from file.
func (*Editor) SaveHistory ¶
SaveHistory saves the current history to the file previously configured with SetAutoSaveHistory.
func (*Editor) SetAutoSaveHistory ¶
SetAutoSaveHistory enables/disables auto-saving of entered lines to the history.