busybox

package
v0.0.0-...-e6c8b48 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClearScreen     = "\033[2J\033[H" // Clear screen and move to home
	ClearToEOL      = "\033[K"        // Clear from cursor to end of line
	ClearToEOS      = "\033[J"        // Clear from cursor to end of screen
	MoveCursorHome  = "\033[H"        // Move cursor to home (top-left)
	ResetCursor     = "\033[0G"       // Move cursor to start of line
	HideCursor      = "\033[?25l"     // Hide cursor
	ShowCursor      = "\033[?25h"     // Show cursor
	InverseVideo    = "\033[7m"       // Inverse/reverse video
	ResetFormatting = "\033[0m"       // Reset all formatting
	CRLF            = "\r\n"          // Carriage return + line feed
	EnterAltScreen  = "\033[?1049h"   // Enter alternate screen
	ExitAltScreen   = "\033[?1049l"   // Exit alternate screen
	SaveScreen      = "\033[?47h"     // Save screen
	RestoreScreen   = "\033[?47l"     // Restore screen
)

ANSI escape codes for terminal control

Variables

This section is empty.

Functions

func InColors

func InColors(c Color, s string) string

func MoveCursorTo

func MoveCursorTo(row, col int) string

func ProcessLine

func ProcessLine(bracket, line string)

func Quit

func Quit(t Term)

func RunTerm

func RunTerm[T any](items []T, toString func(T) string) (T, error)

Types

type Color

type Color string
const (
	Reset Color = "\033[0m"

	Black   Color = "\033[30m"
	Red     Color = "\033[31m"
	Green   Color = "\033[32m"
	Yellow  Color = "\033[33m"
	Blue    Color = "\033[34m"
	Magenta Color = "\033[35m"
	Cyan    Color = "\033[36m"
	White   Color = "\033[37m"

	BrightBlack   Color = "\033[90m"
	BrightRed     Color = "\033[91m"
	BrightGreen   Color = "\033[92m"
	BrightYellow  Color = "\033[93m"
	BrightBlue    Color = "\033[94m"
	BrightMagenta Color = "\033[95m"
	BrightCyan    Color = "\033[96m"
	BrightWhite   Color = "\033[97m"
)

ANSI color codes

type EscapeCode

type EscapeCode string

type HighlightedPager

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

func NewHighlightedPager

func NewHighlightedPager(filename string, content io.Reader) *HighlightedPager

func (*HighlightedPager) Run

func (hp *HighlightedPager) Run() error

type Key

type Key int
const (
	Unknown Key = iota
	CtrlC
	Backspace
	Enter
	Escape
	UpArrow
	DownArrow
	Other
)

type Term

type Term interface {
	Start()
	Close()
	Clear()
	Read() (Key, rune)
	GetSize() error

	// Screen buffer management
	EnterAltBuffer()
	ExitAltBuffer()

	// Access to terminal dimensions
	Width() int
	Height() int
}

func NewTerm

func NewTerm() Term

type Terminal

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

Terminal implements the Term interface

func (*Terminal) Clear

func (t *Terminal) Clear()

func (*Terminal) Close

func (t *Terminal) Close()

func (*Terminal) EnterAltBuffer

func (t *Terminal) EnterAltBuffer()

func (*Terminal) ExitAltBuffer

func (t *Terminal) ExitAltBuffer()

func (*Terminal) GetSize

func (t *Terminal) GetSize() error

func (*Terminal) Height

func (t *Terminal) Height() int

func (*Terminal) Read

func (t *Terminal) Read() (Key, rune)

Read reads from the terminal's tty file descriptor

func (*Terminal) Start

func (t *Terminal) Start()

func (*Terminal) Width

func (t *Terminal) Width() int

Jump to

Keyboard shortcuts

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