go-isatty: github.com/mattn/go-isatty Index | Examples | Files

package isatty

import "github.com/mattn/go-isatty"

Package isatty implements interface to isatty

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

Package Files

doc.go isatty_linux.go

func IsCygwinTerminal Uses

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 Uses

func IsTerminal(fd uintptr) bool

IsTerminal return true if the file descriptor is terminal.

Package isatty imports 2 packages (graph) and is imported by 502 packages. Updated 2018-11-19. Refresh now. Tools for package owners.