Help us shape the future of Go! Take the 2026 Go Developer Survey

lineedit

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package lineedit is wctr's interactive line editor: a thin adapter over the standard-library-only core, github.com/go-wasmcontainers/engine/ lineedit (see its documentation for the editor, ParseKeys, Renderer and Reader), plus WctrCompleter, which completes through cobra's __complete and so needs engine/cli. Everything the package exported before the core was split out is re-exported here as an alias, so the playground and the dashboard compile unchanged.

Code that must not link engine/cli (and so net/http) — the guest shell — imports the core directly.

Index

Constants

View Source
const (
	KeyRune      = core.KeyRune
	KeyEnter     = core.KeyEnter
	KeyBackspace = core.KeyBackspace
	KeyDelete    = core.KeyDelete
	KeyLeft      = core.KeyLeft
	KeyRight     = core.KeyRight
	KeyHome      = core.KeyHome
	KeyEnd       = core.KeyEnd
	KeyUp        = core.KeyUp
	KeyDown      = core.KeyDown
	KeyTab       = core.KeyTab
	KeyEscape    = core.KeyEscape
	KeyCtrlA     = core.KeyCtrlA
	KeyCtrlB     = core.KeyCtrlB
	KeyCtrlC     = core.KeyCtrlC
	KeyCtrlD     = core.KeyCtrlD
	KeyCtrlE     = core.KeyCtrlE
	KeyCtrlF     = core.KeyCtrlF
	KeyCtrlG     = core.KeyCtrlG
	KeyCtrlK     = core.KeyCtrlK
	KeyCtrlL     = core.KeyCtrlL
	KeyCtrlN     = core.KeyCtrlN
	KeyCtrlP     = core.KeyCtrlP
	KeyCtrlR     = core.KeyCtrlR
	KeyCtrlU     = core.KeyCtrlU
	KeyCtrlW     = core.KeyCtrlW
	KeyUnknown   = core.KeyUnknown

	// MaxLine bounds the line being edited, in runes.
	MaxLine = core.MaxLine
)

The keys.

Variables

View Source
var (
	ErrUnterminated = core.ErrUnterminated
	ErrInterrupt    = core.ErrInterrupt
)

ErrUnterminated and ErrInterrupt are the core's errors.

View Source
var (
	// New returns an editor.
	New = core.New
	// R is a character key.
	R = core.R
	// ParseKeys turns terminal input into keys.
	ParseKeys = core.ParseKeys
	// Format lays candidates out for a terminal.
	Format = core.Format
	// Split splits a line into words, shell-style.
	Split = core.Split
	// SplitPartial splits a line prefix into the words before the one being
	// typed and that word.
	SplitPartial = core.SplitPartial
	// Quote quotes a completion for the line's quoting.
	Quote = core.Quote
)

Functions

This section is empty.

Types

type Completer

type Completer = core.Completer

Completer lists the candidates for the word being typed.

func WctrCompleter

func WctrCompleter(o cli.Options, builtins []cli.Candidate) Completer

WctrCompleter completes a line whose first word is "wctr" through the command tree o describes (cobra's __complete, in-process), and the first word itself from builtins (which should include "wctr").

type Editor

type Editor = core.Editor

Editor is the line editor.

type Event

type Event = core.Event

Event is what a key did besides editing.

type Key

type Key = core.Key

Key is one key press.

type KeyCode

type KeyCode = core.KeyCode

KeyCode names a non-character key.

type Options

type Options = core.Options

Options configure an Editor.

type Partial

type Partial = core.Partial

Partial is the word being completed, split from its line.

type Reader added in v0.31.0

type Reader = core.Reader

Reader edits lines read from a raw-mode terminal stream.

type Renderer

type Renderer = core.Renderer

Renderer turns States into ANSI output for a terminal.

type State

type State = core.State

State is what to display.

Jump to

Keyboard shortcuts

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