...
Package isatty
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")
}
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(fd uintptr) bool
IsTerminal return true if the file descriptor is terminal.