Yasuhiro Matsumoto 9b0bf5f2fc update README.md | 7 gadi atpakaļ | |
---|---|---|
_example | 7 gadi atpakaļ | |
.travis.yml | 7 gadi atpakaļ | |
LICENSE | 9 gadi atpakaļ | |
README.md | 7 gadi atpakaļ | |
doc.go | 10 gadi atpakaļ | |
isatty_appengine.go | 9 gadi atpakaļ | |
isatty_bsd.go | 8 gadi atpakaļ | |
isatty_linux.go | 9 gadi atpakaļ | |
isatty_non_windows_test.go | 7 gadi atpakaļ | |
isatty_not_windows.go | 7 gadi atpakaļ | |
isatty_solaris.go | 9 gadi atpakaļ | |
isatty_windows.go | 7 gadi atpakaļ | |
isatty_windows_test.go | 7 gadi atpakaļ |
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