box

package module
v2.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2021 License: BSD-3-Clause Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const (
	CURSOR_OFF = "\x1B[?25l"
	CURSOR_ON  = "\x1B[?25h"
	BOLD_ON    = "\x1B[0;47;30m"
	BOLD_ON2   = "\x1B[0;1;7m"
	BOLD_OFF   = "\x1B[0m"
	UP_N       = "\x1B[%dA"
	ERASE_LINE = "\x1B[0K"
)
View Source
const (
	NONE         = 0
	LEFT         = 1
	DOWN         = 2
	UP           = 3
	RIGHT        = 4
	ENTER        = 5
	LEAVE        = 6
	SELECT_DOWN  = 7
	SELECT_UP    = 8
	SELECT_LEFT  = 9
	SELECT_RIGHT = 10
)
View Source
const (
	K_LEFT       = "\x1B[D"
	K_UP         = "\x1B[A"
	K_RIGHT      = "\x1B[C"
	K_DOWN       = "\x1B[B"
	K_CTRL_F     = "\x06"
	K_CTRL_B     = "\x02"
	K_CTRL_N     = "\x0E"
	K_CTRL_P     = "\x10"
	K_CTRL_G     = "\x07"
	K_CTRL_DOWN  = "\x1B[1;5B"
	K_CTRL_LEFT  = "\x1B[1;5D"
	K_CTRL_RIGHT = "\x1B[1;5C"
	K_CTRL_UP    = "\x1B[1;5A"
)

Variables

View Source
var AnsiCutter = regexp.MustCompile("\x1B[^a-zA-Z]*[A-Za-z]")

Functions

func Choice

func Choice(sources []string, out io.Writer) string

Choice returns selected string

func ChoiceMulti added in v2.0.6

func ChoiceMulti(sources []string, out io.Writer) []string

func Choose

func Choose(sources []string, out io.Writer) int

func ChooseMulti added in v2.0.5

func ChooseMulti(sources []string, out io.Writer) []int

Choice returns the index of selected string

func New

func New() *box_t

func Print

func Print(ctx context.Context, nodes []string, out io.Writer) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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