Clone this repo:
  1. c067b4f Merge pull request #86 from dolmen-go/testing-log-result by mattn · 6 months ago master v0.0.19
  2. 42997b3 tests: log value of IsTerminal by Olivier Mengué · 6 months ago
  3. 72a590e Merge pull request #82 from dolmen-go/upgrade-x-sys-tagged by mattn · 6 months ago v0.0.18
  4. c84e2cc Merge pull request #83 from dolmen-go/ci-add-go1.20 by mattn · 6 months ago
  5. 77d7704 CI: add Go 1.20 by Olivier Mengué · 6 months ago

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