lined

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package lined is line editor, supports operations on terminal.

Supported operations includes short-cut like Ctrl-A Ctrl-E Ctrl-C Ctrl-D... and UP/DOWN for history.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cfg

type Cfg struct {
	Prompt string
}

Cfg is the options that lined supports, used when New the Editor instance.

type Editor

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

Editor is the instance of a line editor

func NewEditor

func NewEditor(cfg Cfg) *Editor

NewEditor returns an instance of Editor, with user defined Cfg.

func (*Editor) Close

func (ed *Editor) Close()

Close returns the terminal to its previous mode.

func (*Editor) Readline

func (ed *Editor) Readline() (line string, err error)

Readline reads and returns a line from input not including a trailing newline character. Readline returns empty line if user only inputs a newline. An io.EOF error is returned if user entered Ctrl-D. Support multi line continuation ending with "\".

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL