term

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CR  = []byte{'\r'}
	EOL = []byte{'\n'}
)

Functions

func Black added in v0.10.3

func Black(msg string) string

Black returns a black colored string for terminal output.

func Blue added in v0.8.1

func Blue(msg string) string

Blue returns a blue colored string for terminal output.

func Bold added in v0.10.3

func Bold(msg string) string

func ClearLine

func ClearLine()

ClearLine erase the current line.

func ClearLineLeft added in v0.10.3

func ClearLineLeft()

ClearLineLeft erase the current line from the beginning of the line to the cursor

func ClearLineRight

func ClearLineRight()

ClearLineRight erase the current line from the cursor to the end of the line

func ClearScreen

func ClearScreen()

ClearScreen erase the entire screen

func Confirm added in v0.9.2

func Confirm(raw Raw, prompt string) (value bool)

Confirm asks the user for a yes or no answer.

func Cyan

func Cyan(msg string) string

Cyan returns a cyan colored string for terminal output.

func Default added in v0.10.3

func Default(msg string) string

Default returns a default colored string for terminal output.

func Dim

func Dim(msg string) string

Dim returns a grey colored string for terminal output.

func Green

func Green(msg string) string

Green returns a green colored string for terminal output.

func HideCursor

func HideCursor()

HideCursor hides the cursor.

func Input added in v0.9.2

func Input(raw Raw, prompt string, defaultValue string) (value string)

Input asks the user for a string input.

func Italic added in v0.10.3

func Italic(msg string) string

func Magenta

func Magenta(msg string) string

Magenta returns a magenta colored string for terminal output.

func MoveCursorDown

func MoveCursorDown(n int)

MoveCursorDown moves the cursor down.

func MoveCursorLeft

func MoveCursorLeft(n int)

MoveCursorLeft moves the cursor left.

func MoveCursorRight

func MoveCursorRight(n int)

MoveCursorRight moves the cursor right.

func MoveCursorTo added in v0.8.1

func MoveCursorTo(x, y int)

MoveCursorTo moves the cursor to the specified position.

func MoveCursorUp

func MoveCursorUp(n int)

MoveCursorUp moves the cursor up.

func Red

func Red(msg string) string

Red returns a red colored string for terminal output.

func RestoreCursor added in v0.8.1

func RestoreCursor()

RestoreCursor restores the cursor position (DEC).

func SaveCursor added in v0.8.1

func SaveCursor()

SaveCursor saves the current cursor position (DEC).

func Select added in v0.9.2

func Select(raw Raw, prompt string, items []string) (selected string)

Select asks the user to select an item from a list.

func ShowCursor

func ShowCursor()

ShowCursor shows the cursor.

func Strikethrough added in v0.10.3

func Strikethrough(msg string) string

func Underline added in v0.10.3

func Underline(msg string) string

func White added in v0.10.3

func White(msg string) string

White returns a white colored string for terminal output.

func Yellow

func Yellow(msg string) string

Yellow returns a yellow colored string for terminal output.

Types

type Raw added in v0.9.2

type Raw interface {
	Next() byte
}

Raw is an interface for reading raw input.

type Spinner added in v0.10.2

type Spinner struct {
	SpinnerConfig
	// contains filtered or unexported fields
}

Spinner is a spinner for terminal apps.

func NewSpinner added in v0.10.2

func NewSpinner(config SpinnerConfig) *Spinner

NewSpinner creates a new spinner.

func (*Spinner) Start added in v0.10.2

func (t *Spinner) Start()

Start starts the spinner.

func (*Spinner) Stop added in v0.10.2

func (t *Spinner) Stop()

Stop stops the spinner.

type SpinnerConfig added in v0.10.3

type SpinnerConfig struct {
	Chars   []string
	Message string
	FPS     int
}

Jump to

Keyboard shortcuts

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