terminfo

package module
v0.0.0-...-e59d11a Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2017 License: MIT Imports: 3 Imported by: 2

README

terminfo

GoDoc Build Status

A small subset of functionality pulled from upstream Golang golang.org/x/crypto library.

  1. Is the given Fd, File or Stdout/Stderr a terminal/TTY?
  2. What are the dimensions of the terminal for the given Fd, File, or Stdout/Stderr.

See the example for a demo.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DimensionsOrDefault

func DimensionsOrDefault(twidth, theight, defaultwidth, defaultheight int) (width, height int)

DimensionsOrDefault is a helper method to use default dimensions rather than the output dimensions in cases where there was an error reading the dimensions.

func DimensionsOrMin

func DimensionsOrMin(twidth, theight, minwidth, minheight int) (width, height int)

DimensionsOrMin is a helper method to use minimum dimensions rather than the output dimensions in cases where there was an error or the dimensions were smaller than expected.

func GetFDDimensions

func GetFDDimensions(fd uintptr) (width, height int, err error)

GetFDDimensions returns the dimensions of the given terminal.

func GetFileDimensions

func GetFileDimensions(f *os.File) (width, height int, err error)

GetFileDimensions returns the dimensions of the given file by looking at its file descriptor.

func GetStderrDimensions

func GetStderrDimensions() (width, height int, err error)

GetStderrDimensions returns the dimensions of the stderr

func GetStdoutDimensions

func GetStdoutDimensions() (width, height int, err error)

GetStdoutDimensions returns the dimensions of the stdout

func IsFDTerminal

func IsFDTerminal(fd uintptr) bool

IsFDTerminal returns true if the given file descriptor is a terminal. This is borrowed from golang/crypto/blob/master/ssh/terminal/util.go

func IsFileTerminal

func IsFileTerminal(f *os.File) bool

IsFileTerminal returns true if the given file's descriptor is a terminal

func IsStderrTerminal

func IsStderrTerminal() bool

IsStderrTerminal returns true if os.Stderr is a terminal

func IsStdoutTerminal

func IsStdoutTerminal() bool

IsStdoutTerminal returns true if os.Stdout is a terminal

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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