Clone this repo:
  1. fc9e8d8 Merge pull request #17 from dolmen-go/move-example-to-godoc by mattn · 5 months ago master v0.0.2
  2. b6ee8e8 Move example to godoc by Olivier Mengué · 5 months ago
  3. 57fdcb9 Merge pull request #16 from lgonzalez-silen/master by mattn · 5 months ago
  4. 2c84d1a Add isCygwinTerminal to non-appengine environments by Luis · 5 months ago
  5. 9622e0c fix badges by Yasuhiro Matsumoto · 6 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