Back to godoc.org
github.com/mattn/go-isatty

package isatty

v0.0.12
Latest Go to latest
Published: Jan 21, 2020 | License: MIT | Module: github.com/mattn/go-isatty

Overview

Package isatty implements interface to isatty

Example

Code:

if isatty.IsTerminal(os.Stdout.Fd()) {
	fmt.Println("Is Terminal")
} else if isatty.IsCygwinTerminal(os.Stdout.Fd()) {
	fmt.Println("Is Cygwin/MSYS2 Terminal")
} else {
	fmt.Println("Is Not Terminal")
}

Index

Examples

func IsCygwinTerminal

func IsCygwinTerminal(fd uintptr) bool

IsCygwinTerminal return true if the file descriptor is a cygwin or msys2 terminal. This is also always false on this environment.

func IsTerminal

func IsTerminal(fd uintptr) bool

IsTerminal return true if the file descriptor is terminal.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier