Clone this repo:
  1. a7c0235 Merge pull request #74 from dkegel-fastly/dkegel-bug73-tinygo by mattn · 1 year, 2 months ago master v0.0.20
  2. 13f3590 Adjust build tags to allow building on tinygo; for #73. by Dan Kegel · 2 years, 6 months ago
  3. c067b4f Merge pull request #86 from dolmen-go/testing-log-result by mattn · 1 year, 9 months ago v0.0.19
  4. 42997b3 tests: log value of IsTerminal by Olivier Mengué · 1 year, 9 months ago
  5. 72a590e Merge pull request #82 from dolmen-go/upgrade-x-sys-tagged by mattn · 1 year, 9 months ago v0.0.18

go-isatty

Godoc Reference Codecov 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