tangs b030ce89ca openbilibili | 5 years ago | |
---|---|---|
.. | ||
BUILD | 5 years ago | |
LICENSE | 5 years ago | |
README.md | 5 years ago | |
doc.go | 5 years ago | |
isatty_bsd.go | 5 years ago | |
isatty_linux.go | 5 years ago | |
isatty_linux_ppc64x.go | 5 years ago | |
isatty_others.go | 5 years ago | |
isatty_solaris.go | 5 years ago | |
isatty_windows.go | 5 years ago |
isatty for golang
package main
import (
"fmt"
"github.com/mattn/go-isatty"
"os"
)
func main() {
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")
}
}
$ go get github.com/mattn/go-isatty
MIT
Yasuhiro Matsumoto (a.k.a mattn)
k-takata: base idea for IsCygwinTerminal