example_test.go 306 B

123456789101112131415161718
  1. package isatty_test
  2. import (
  3. "fmt"
  4. "os"
  5. "github.com/mattn/go-isatty"
  6. )
  7. func Example() {
  8. if isatty.IsTerminal(os.Stdout.Fd()) {
  9. fmt.Println("Is Terminal")
  10. } else if isatty.IsCygwinTerminal(os.Stdout.Fd()) {
  11. fmt.Println("Is Cygwin/MSYS2 Terminal")
  12. } else {
  13. fmt.Println("Is Not Terminal")
  14. }
  15. }