Versions in this module Expand all Collapse all v0 v0.1.0 Aug 14, 2017 Changes in this version + func BisectLeft(a []int, v int) int + func BisectRight(a []int, v int) int + func Choose(prefix string, choices []string, opts ...option) string + func Input(prefix string, completer Completer, opts ...option) string + func OptionAddKeyBind(b ...KeyBind) option + func OptionDescriptionBGColor(x Color) option + func OptionDescriptionTextColor(x Color) option + func OptionHistory(x []string) option + func OptionInputBGColor(x Color) option + func OptionInputTextColor(x Color) option + func OptionMaxSuggestion(x uint16) option + func OptionParser(x ConsoleParser) option + func OptionPrefix(x string) option + func OptionPrefixBackgroundColor(x Color) option + func OptionPrefixTextColor(x Color) option + func OptionPreviewSuggestionBGColor(x Color) option + func OptionPreviewSuggestionTextColor(x Color) option + func OptionSelectedDescriptionBGColor(x Color) option + func OptionSelectedDescriptionTextColor(x Color) option + func OptionSelectedSuggestionBGColor(x Color) option + func OptionSelectedSuggestionTextColor(x Color) option + func OptionSuggestionBGColor(x Color) option + func OptionSuggestionTextColor(x Color) option + func OptionTitle(x string) option + func OptionWriter(x ConsoleWriter) option + func SwitchKeyBindMode(m KeyBindMode) option + type ASCIICode struct + ASCIICode []byte + Key Key + type Buffer struct + CursorPosition int + func NewBuffer() (b *Buffer) + func (b *Buffer) CursorDown(count int) + func (b *Buffer) CursorLeft(count int) + func (b *Buffer) CursorRight(count int) + func (b *Buffer) CursorUp(count int) + func (b *Buffer) Delete(count int) (deleted string) + func (b *Buffer) DeleteBeforeCursor(count int) (deleted string) + func (b *Buffer) Document() (d *Document) + func (b *Buffer) InsertText(v string, overwrite bool, moveCursor bool) + func (b *Buffer) JoinNextLine(separator string) + func (b *Buffer) NewLine(copyMargin bool) + func (b *Buffer) SwapCharactersBeforeCursor() + func (b *Buffer) Text() string + type Color int + const Black + const Blue + const Brown + const Cyan + const DarkBlue + const DarkGray + const DarkGreen + const DarkRed + const DefaultColor + const Fuchsia + const Green + const LightGray + const Purple + const Red + const Turquoise + const White + const Yellow + type Completer func(Document) []Suggest + type CompletionManager struct + func NewCompletionManager(completer Completer, max uint16) *CompletionManager + func (c *CompletionManager) Completing() bool + func (c *CompletionManager) GetSelectedSuggestion() (s Suggest, ok bool) + func (c *CompletionManager) GetSuggestions() []Suggest + func (c *CompletionManager) Next() + func (c *CompletionManager) Previous() + func (c *CompletionManager) Reset() + func (c *CompletionManager) Update(in Document) + type ConsoleParser interface + GetKey func(b []byte) Key + GetWinSize func() *WinSize + Setup func() error + TearDown func() error + type ConsoleWriter interface + AskForCPR func() + ClearTitle func() + CursorBackward func(n int) + CursorDown func(n int) + CursorForward func(n int) + CursorGoTo func(row, col int) + CursorUp func(n int) + EraseDown func() + EraseEndOfLine func() + EraseLine func() + EraseScreen func() + EraseStartOfLine func() + EraseUp func() + Flush func() error + HideCursor func() + SaveCursor func() + ScrollDown func() + ScrollUp func() + SetColor func(fg, bg Color, bold bool) + SetTitle func(title string) + ShowCursor func() + UnSaveCursor func() + Write func(data []byte) + WriteRaw func(data []byte) + WriteRawStr func(data string) + WriteStr func(data string) + type Document struct + CursorPosition int + Text string + func NewDocument() *Document + func (d *Document) CurrentLine() string + func (d *Document) CurrentLineAfterCursor() string + func (d *Document) CurrentLineBeforeCursor() string + func (d *Document) CursorPositionCol() (col int) + func (d *Document) CursorPositionRow() (row int) + func (d *Document) FindStartOfPreviousWord() int + func (d *Document) GetCharRelativeToCursor(offset int) (r rune) + func (d *Document) GetCursorDownPosition(count int, preferredColumn int) int + func (d *Document) GetCursorLeftPosition(count int) int + func (d *Document) GetCursorRightPosition(count int) int + func (d *Document) GetCursorUpPosition(count int, preferredColumn int) int + func (d *Document) GetEndOfLinePosition() int + func (d *Document) GetWordBeforeCursor() string + func (d *Document) LineCount() int + func (d *Document) Lines() []string + func (d *Document) OnLastLine() bool + func (d *Document) TextAfterCursor() string + func (d *Document) TextBeforeCursor() string + func (d *Document) TranslateIndexToPosition(index int) (row int, col int) + func (d *Document) TranslateRowColToIndex(row int, column int) (index int) + type Exec struct + type Executor func(string) + type Filter func([]Suggest, string, bool) []Suggest + type History struct + func NewHistory() *History + func (h *History) Add(input string) + func (h *History) Clear() + func (h *History) Newer(buf *Buffer) (new *Buffer, changed bool) + func (h *History) Older(buf *Buffer) (new *Buffer, changed bool) + type Key int + const Any + const BackTab + const Backspace + const BracketedPaste + const CPRResponse + const ControlA + const ControlB + const ControlBackslash + const ControlC + const ControlCircumflex + const ControlD + const ControlDelete + const ControlDown + const ControlE + const ControlF + const ControlG + const ControlH + const ControlI + const ControlJ + const ControlK + const ControlL + const ControlLeft + const ControlM + const ControlN + const ControlO + const ControlP + const ControlQ + const ControlR + const ControlRight + const ControlS + const ControlSpace + const ControlSquareClose + const ControlT + const ControlU + const ControlUnderscore + const ControlUp + const ControlV + const ControlW + const ControlX + const ControlY + const ControlZ + const Delete + const Down + const End + const Enter + const Escape + const F1 + const F10 + const F11 + const F12 + const F13 + const F14 + const F15 + const F16 + const F17 + const F18 + const F19 + const F2 + const F20 + const F21 + const F22 + const F23 + const F24 + const F3 + const F4 + const F5 + const F6 + const F7 + const F8 + const F9 + const Home + const Ignore + const Insert + const Left + const NotDefined + const PageDown + const PageUp + const Right + const ShiftDelete + const ShiftDown + const ShiftLeft + const ShiftRight + const ShiftUp + const Tab + const Up + const Vt100MouseEvent + const WindowsMouseEvent + func (i Key) String() string + type KeyBind struct + Fn KeyBindFunc + Key Key + type KeyBindFunc func(*Buffer) + type KeyBindMode string + const CommonKeyBind + const EmacsKeyBind + type Prompt struct + func New(executor Executor, completer Completer, opts ...option) *Prompt + func (p *Prompt) Input() string + func (p *Prompt) Run() + type Render struct + func (r *Render) BreakLine(buffer *Buffer) + func (r *Render) Render(buffer *Buffer, completion *CompletionManager) + func (r *Render) Setup() + func (r *Render) TearDown() + func (r *Render) UpdateWinSize(ws *WinSize) + type Suggest struct + Description string + Text string + func FilterContains(completions []Suggest, sub string, ignoreCase bool) []Suggest + func FilterHasPrefix(completions []Suggest, sub string, ignoreCase bool) []Suggest + func FilterHasSuffix(completions []Suggest, sub string, ignoreCase bool) []Suggest + type VT100Parser struct + func NewVT100StandardInputParser() *VT100Parser + func (t *VT100Parser) GetKey(b []byte) Key + func (t *VT100Parser) GetWinSize() *WinSize + func (t *VT100Parser) Setup() error + func (t *VT100Parser) TearDown() error + type VT100Writer struct + func NewVT100StandardOutputWriter() *VT100Writer + func (w *VT100Writer) AskForCPR() + func (w *VT100Writer) ClearTitle() + func (w *VT100Writer) CursorBackward(n int) + func (w *VT100Writer) CursorDown(n int) + func (w *VT100Writer) CursorForward(n int) + func (w *VT100Writer) CursorGoTo(row, col int) + func (w *VT100Writer) CursorUp(n int) + func (w *VT100Writer) EraseDown() + func (w *VT100Writer) EraseEndOfLine() + func (w *VT100Writer) EraseLine() + func (w *VT100Writer) EraseScreen() + func (w *VT100Writer) EraseStartOfLine() + func (w *VT100Writer) EraseUp() + func (w *VT100Writer) Flush() error + func (w *VT100Writer) HideCursor() + func (w *VT100Writer) SaveCursor() + func (w *VT100Writer) ScrollDown() + func (w *VT100Writer) ScrollUp() + func (w *VT100Writer) SetColor(fg, bg Color, bold bool) + func (w *VT100Writer) SetTitle(title string) + func (w *VT100Writer) ShowCursor() + func (w *VT100Writer) UnSaveCursor() + func (w *VT100Writer) Write(data []byte) + func (w *VT100Writer) WriteRaw(data []byte) + func (w *VT100Writer) WriteRawStr(data string) + func (w *VT100Writer) WriteStr(data string) + type WinSize struct + Col uint16 + Row uint16