Clone this repo:
  1. cdb00f1 Merge pull request #68 from tklauser/fix-go.sum by mattn · 6 months ago master
  2. 689cfc2 Update go.sum after golang.org/x/sys update by Tobias Klauser · 8 months ago
  3. d423e9c Merge pull request #67 from tklauser/fix-go-version-gh-action by mattn · 8 months ago
  4. 65c33a1 Use correct field to specify Go version in GitHub action by Tobias Klauser · 8 months ago
  5. 504425e Merge pull request #66 from cookieY/sys by mattn · 9 months ago v0.0.14

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