Documentation ¶
Index ¶
- Constants
- Variables
- func CursorDownN(n int) string
- func CursorLeftN(n int) string
- func CursorRightN(n int) string
- func CursorUpN(n int) string
- func InitRenderer() (*glamour.TermRenderer, error)
- func PromptForBool(label string, defaultVal bool) bool
- func PromptForKey(label string) uint16
- func PromptForString(label string, defaultVal string, validate func(string) error) string
- func PromptSelectString(label string, items []string) string
- func ReadInput(inputCh chan<- string, inputErrCh chan<- error, readyCh <-chan struct{})
- func ReadInputOnce(rl *Instance) (string, error)
- type Buffer
- func (b *Buffer) Add(r rune)
- func (b *Buffer) AddChar(r rune, insert bool)
- func (b *Buffer) ClearScreen()
- func (b *Buffer) Delete()
- func (b *Buffer) DeleteBefore()
- func (b *Buffer) DeleteRemaining()
- func (b *Buffer) DeleteWord()
- func (b *Buffer) DisplaySize() int
- func (b *Buffer) GetLineSpacing(line int) bool
- func (b *Buffer) IsEmpty() bool
- func (b *Buffer) MoveLeft()
- func (b *Buffer) MoveLeftWord()
- func (b *Buffer) MoveRight()
- func (b *Buffer) MoveRightWord()
- func (b *Buffer) MoveToEnd()
- func (b *Buffer) MoveToStart()
- func (b *Buffer) Remove()
- func (b *Buffer) Replace(r []rune)
- func (b *Buffer) String() string
- func (b *Buffer) StringN(n int) string
- func (b *Buffer) StringNM(n, m int) string
- type Instance
- type MultilineState
- type Prompt
- type Renderer
- type ScreenBuf
- type Spinner
- type Terminal
Constants ¶
View Source
const ( CharNull = 0 CharLineStart = 1 CharBackward = 2 CharInterrupt = 3 CharDelete = 4 CharLineEnd = 5 CharForward = 6 CharBell = 7 CharCtrlH = 8 CharTab = 9 CharCtrlJ = 10 CharKill = 11 CharCtrlL = 12 CharEnter = 13 CharNext = 14 CharPrev = 16 CharBckSearch = 18 CharFwdSearch = 19 CharTranspose = 20 CharCtrlU = 21 CharCtrlW = 23 CharCtrlY = 25 CharCtrlZ = 26 CharEsc = 27 CharSpace = 32 CharEscapeEx = 91 CharBackspace = 127 )
View Source
const ( KeyDel = 51 KeyUp = 65 KeyDown = 66 KeyRight = 67 KeyLeft = 68 MetaEnd = 70 MetaStart = 72 )
View Source
const ( Esc = "\x1b" CursorSave = Esc + "[s" CursorRestore = Esc + "[u" CursorEOL = Esc + "[E" CursorBOL = Esc + "[1G" CursorHide = Esc + "[?25l" CursorShow = Esc + "[?25h" ClearToEOL = Esc + "[K" ClearLine = Esc + "[2K" ClearScreen = Esc + "[2J" CursorReset = Esc + "[0;0f" ColorGrey = Esc + "[38;5;245m" ColorDefault = Esc + "[0m" StartBracketedPaste = Esc + "[?2004h" EndBracketedPaste = Esc + "[?2004l" )
View Source
const ( CharBracketedPaste = 50 CharBracketedPasteStart = "00~" CharBracketedPasteEnd = "01~" )
Variables ¶
View Source
var ( ErrInputInterrupted = errors.New("input interrupted") ErrInputKilled = errors.New("input killed") ErrReadlineInit = errors.New("error initializing readline") )
View Source
var ( CursorUp = CursorUpN(1) CursorDown = CursorDownN(1) CursorRight = CursorRightN(1) CursorLeft = CursorLeftN(1) )
Functions ¶
func CursorDownN ¶ added in v0.2.2
func CursorLeftN ¶ added in v0.2.2
func CursorRightN ¶ added in v0.2.2
func InitRenderer ¶
func InitRenderer() (*glamour.TermRenderer, error)
func PromptForBool ¶
func PromptForKey ¶ added in v0.2.0
func PromptForString ¶
func PromptSelectString ¶ added in v0.2.0
func ReadInputOnce ¶ added in v0.2.0
Types ¶
type Buffer ¶ added in v0.2.2
type Buffer struct { DisplayPos int Pos int Buf *arraylist.List // LineHasSpace is an arraylist of bools to keep track of whether a line has a space at the end LineHasSpace *arraylist.List Prompt *Prompt LineWidth int Width int Height int }
func (*Buffer) ClearScreen ¶ added in v0.2.2
func (b *Buffer) ClearScreen()
func (*Buffer) DeleteBefore ¶ added in v0.2.2
func (b *Buffer) DeleteBefore()
func (*Buffer) DeleteRemaining ¶ added in v0.2.2
func (b *Buffer) DeleteRemaining()
func (*Buffer) DeleteWord ¶ added in v0.2.2
func (b *Buffer) DeleteWord()
func (*Buffer) DisplaySize ¶ added in v0.2.2
func (*Buffer) GetLineSpacing ¶ added in v0.2.2
func (*Buffer) MoveLeftWord ¶ added in v0.2.2
func (b *Buffer) MoveLeftWord()
func (*Buffer) MoveRightWord ¶ added in v0.2.2
func (b *Buffer) MoveRightWord()
func (*Buffer) MoveToStart ¶ added in v0.2.2
func (b *Buffer) MoveToStart()
type Instance ¶ added in v0.2.2
func InitReadline ¶
func (*Instance) HistoryDisable ¶ added in v0.2.2
func (i *Instance) HistoryDisable()
func (*Instance) HistoryEnable ¶ added in v0.2.2
func (i *Instance) HistoryEnable()
type MultilineState ¶
type MultilineState int
const ( MultilineNone MultilineState = iota MultilinePrompt MultilineSystem MultilineTemplate )
type Renderer ¶
type Renderer = glamour.TermRenderer
type ScreenBuf ¶
type ScreenBuf struct {
// contains filtered or unexported fields
}
func NewScreenBuf ¶
type Terminal ¶ added in v0.2.2
type Terminal struct {
// contains filtered or unexported fields
}
func NewTerminal ¶ added in v0.2.2
Click to show internal directories.
Click to hide internal directories.