Clone this repo:
  1. a5cdd64 Merge pull request #20 from mattn/fix-ppc64 by mattn · 4 weeks ago master
  2. 0360b2a revert change of isatty_others.go by Yasuhiro Matsumoto · 4 weeks ago v0.0.3
  3. 78c7b22 both fixes ppc64,ppc64le by Yasuhiro Matsumoto · 4 weeks ago
  4. b8318a2 fix build-constraints by Yasuhiro Matsumoto · 4 weeks ago
  5. 34aedb9 use golang.org/x/sys on ppc64, ppc64le by Yasuhiro Matsumoto · 4 weeks ago

go-isatty

Godoc Reference Build Status Coverage Status Go Report Card

isatty for golang

Usage

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")
	}
}

Installation

$ go get github.com/mattn/go-isatty

License

MIT

Author

Yasuhiro Matsumoto (a.k.a mattn)

Thanks