linereader

package
v0.0.0-...-1f420dc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Backspace rune = '\x7F'
	CtrlA     rune = '\x01'
	CtrlC     rune = '\x03'
	CtrlD     rune = '\x04'
	CtrlE     rune = '\x05'

	Escape byte = '\x1b'
)

Variables

This section is empty.

Functions

func ReadLine

func ReadLine(prompt string) (string, error)

Types

type Command

type Command int
const (
	CommandNone Command = iota
	CommandExit
	CommandUp
	CommandDown
)

type LineReader

type LineReader struct {
	// contains filtered or unexported fields
}

func New

func New(prompt string) (*LineReader, error)

func (*LineReader) Close

func (lr *LineReader) Close() error

func (*LineReader) Prompt

func (lr *LineReader) Prompt()

func (*LineReader) Read

func (lr *LineReader) Read() (string, Command, error)

Read reads a single character from the user's input, and then returns the current input. Note that for certain actions (e.g. moving the cursor) the input returned by Read may be the same as the previous input. It is up to the caller to deduplicate responses if they care to.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳