https://github.com/mudler/go-isterminal
Check if we are running in a terminal or not
https://github.com/mudler/go-isterminal
Last synced: 11 months ago
JSON representation
Check if we are running in a terminal or not
- Host: GitHub
- URL: https://github.com/mudler/go-isterminal
- Owner: mudler
- License: mit
- Created: 2021-10-31T13:56:11.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-10-31T13:57:57.000Z (over 4 years ago)
- Last Synced: 2025-02-02T07:43:25.784Z (over 1 year ago)
- Language: Go
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-isterminal
Simply check if the passed io.Writer is a attached to a terminal or not.
This lib is a slightly readaptation of what's inside logrus: https://github.com/sirupsen/logrus/blob/master/terminal_check_appengine.go so any credit goes to them. I've just de-tached this part and exposed it publicly as I find it useful in other contexts too.
## Usage
```golang
import (
terminal "github.com/mudler/go-isterminal"
)
func main() {
if terminal.IsTerminal(os.Stdout) {
....
}
}
```