README.md (1088B)
1 # go-isatty 2 3 [](http://godoc.org/github.com/mattn/go-isatty) 4 [](https://codecov.io/gh/mattn/go-isatty) 5 [](https://coveralls.io/github/mattn/go-isatty?branch=master) 6 [](https://goreportcard.com/report/mattn/go-isatty) 7 8 isatty for golang 9 10 ## Usage 11 12 ```go 13 package main 14 15 import ( 16 "fmt" 17 "github.com/mattn/go-isatty" 18 "os" 19 ) 20 21 func main() { 22 if isatty.IsTerminal(os.Stdout.Fd()) { 23 fmt.Println("Is Terminal") 24 } else if isatty.IsCygwinTerminal(os.Stdout.Fd()) { 25 fmt.Println("Is Cygwin/MSYS2 Terminal") 26 } else { 27 fmt.Println("Is Not Terminal") 28 } 29 } 30 ``` 31 32 ## Installation 33 34 ``` 35 $ go get github.com/mattn/go-isatty 36 ``` 37 38 ## License 39 40 MIT 41 42 ## Author 43 44 Yasuhiro Matsumoto (a.k.a mattn) 45 46 ## Thanks 47 48 * k-takata: base idea for IsCygwinTerminal 49 50 https://github.com/k-takata/go-iscygpty