term

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2022 License: MIT Imports: 5 Imported by: 12

README

term License Go Report Card Build and Tests Codecov PkgGoDev Release GitHub go.mod Go version

Golang package with convenience functions for terminal related tasks.

Documentation

Overview

Package term contains convenience functions for terminal related tasks, for example to get the current terminal width or a reasonable fallback.

Index

Constants

View Source
const DefaultTerminalHeight = 25

DefaultTerminalHeight is the default fallback terminal height.

View Source
const DefaultTerminalWidth = 80

DefaultTerminalWidth is the default fallback terminal width.

Variables

View Source
var FixedTerminalHeight = -1

FixedTerminalHeight allows a manual fixed override of the terminal height.

View Source
var FixedTerminalWidth = -1

FixedTerminalWidth allows a manual fixed override of the terminal width.

Functions

func GetTerminalHeight

func GetTerminalHeight() int

GetTerminalHeight return the terminal height (available lines).

func GetTerminalSize

func GetTerminalSize() (int, int)

GetTerminalSize return the terminal size as a width and height tuple. In case the terminal size cannot be determined, a reasonable default is used: 80x25. A manual override is possible using FixedTerminalWidth and FixedTerminalHeight.

func GetTerminalWidth

func GetTerminalWidth() int

GetTerminalWidth return the terminal width (available characters per line)

func HideCursor

func HideCursor()

HideCursor sends the ANSI sequence to hide the cursor symbol

func IsDumbTerminal

func IsDumbTerminal() bool

IsDumbTerminal returns whether the current terminal has a limited feature set

func IsGardenContainer

func IsGardenContainer() bool

IsGardenContainer returns whether the current process is started in the process tree of garden container (https://github.com/cloudfoundry/garden).

func IsTerminal

func IsTerminal() bool

IsTerminal returns whether this program runs in a terminal and not in a pipe

func IsTrueColor

func IsTrueColor() bool

IsTrueColor returns whether the current terminal supports 24 bit colors

func ShowCursor

func ShowCursor()

ShowCursor sends the ANSI sequence to show the cursor symbol

Types

This section is empty.

Jump to

Keyboard shortcuts

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