tctl

package
v0.0.0-...-fc9014c Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ESC = "\033"
	CSI = ESC + "["

	// control
	CLEAR    = CSI + "2J"
	HIDE_CUR = CSI + "?25l"
	SHOW_CUR = CSI + "?25h"
	MOVE_CUR = CSI + "%d;%dH"
	SAVE_CUR = CSI + "s"
	LOAD_CUR = CSI + "u"
	ALT_SCR  = CSI + "?47h"
	DEF_SCR  = CSI + "?47l"

	// mouse control
	MOUSE_X11_ENABLE      = CSI + "?1000h"
	MOUSE_X11_DISABLE     = CSI + "?1000l"
	MOUSE_X11_HI_ENABLE   = CSI + "?1002h"
	MOUSE_X11_HI_DISABLE  = CSI + "?1002l"
	MOUSE_X11_ALL_ENABLE  = CSI + "?1003h"
	MOUSE_X11_ALL_DISABLE = CSI + "?1003l"

	// print
	NORMAL  = CSI + "0m"
	BOLD    = CSI + "1m"
	REVERSE = CSI + "7m"

	// default foreground colors
	FBLACK   = CSI + "30m"
	FRED     = CSI + "31m"
	FGREEN   = CSI + "32m"
	FBROWN   = CSI + "33m"
	FBLUE    = CSI + "34m"
	FMAGENTA = CSI + "35m"
	FCYAN    = CSI + "36m"
	FWHITE   = CSI + "37m"

	// default background colors
	BBLACK   = CSI + "40m"
	BRED     = CSI + "41m"
	BGREEN   = CSI + "42m"
	BBROWN   = CSI + "43m"
	BBLUE    = CSI + "44m"
	BMAGENTA = CSI + "45m"
	BCYAN    = CSI + "46m"
	BWHITE   = CSI + "47m"

	// 256 colors
	FCOL256 = CSI + "38;5;%dm"
	BCOL256 = CSI + "48;5;%dm"
)

Variables

This section is empty.

Functions

func AltScreen

func AltScreen()

AltScreen switches to the alternate terminal screen This may do nothing on some terminals

func BgCol

func BgCol(c uint8) string

BgCol returns sequence for background 256color c (0-255)

func Clear

func Clear()

Clear clears the terminal and sets the cursor to the topleft position

func DefaultScreen

func DefaultScreen()

Default switches to the default terminal screen This may do nothing on some terminals

func Dimensions

func Dimensions() (w, h int)

Dimensions returns terminal width / height

func FgCol

func FgCol(c uint8) string

FgCol returns sequence for foreground 256color c (0-255)

func Goto

func Goto(x, y int)

Goto moves the cursor to the specified position

func HideCur

func HideCur()

HideCur hides the cursor

func IsTerminal

func IsTerminal() bool

IsTerminal determines if STDIN & STDOUT are connected to terminal devices

func LoadCur

func LoadCur()

LoadCur restores cursor to stored pos (SaveCur())

func MouseDisable

func MouseDisable()

MouseDisable disables terminal mouse support

func MouseEnable

func MouseEnable(mode int)

MouseEnable enables terminal mouse support. mode determines the mode to use. 0=normal, 1=highlight, 2+=all

func Raw

func Raw()

Raw puts the terminal into Raw-Mode

func Restore

func Restore()

Restore the terminal to its stored state

func SaveCur

func SaveCur()

SaveCur saves cursor position

func ShowCur

func ShowCur()

ShowCur shows the cursor

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳