Discover Packages
github.com/qd-um/go-isatty
package
module
Version:
v0.0.3
Opens a new window with list of versions in this module.
Published: Sep 25, 2017
License: MIT
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 1 module, 1 package
The first number is the count of modules that contain a package that imports this one.
The module count is a better indicator of popularity than the package count.
A module with 100 importing packages is counted only once instead of 100 times,
reflecting the fact that the choice to use the package was likely made only once,
not 100 times.
A '?' means that the value hasn't been computed yet.
Opens a new window with list of known importers.
README
README
¶
go-isatty
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
Expand ▾
Collapse ▴
Documentation
¶
Rendered for
linux/amd64
windows/amd64
darwin/amd64
js/wasm
Package isatty implements interface to isatty
package main
import (
"fmt"
"os"
"github.com/mattn/go-isatty"
)
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")
}
}
Output:
IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2
terminal. This is also always false on this environment.
IsTerminal return true if the file descriptor is terminal.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.