Clone this repo:
  1. 3fb116b rename isatty_appengine.go to isatty_others.go by Marcelo Pires · 4 months ago master
  2. 0cbfc10 remove isatty_others by Marcelo Pires · 4 months ago
  3. f3a64f2 restore accidentally removed build constrain by Marcelo Pires · 4 months ago
  4. 5aaf3c6 merge with appeengine by Marcelo Pires · 4 months ago
  5. 7111110 fix missing build constrain by Marcelo Pires · 4 months 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