terminal

package module
v0.0.0-...-5e4e06f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2021 License: MIT Imports: 3 Imported by: 1

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


import (
    terminal "github.com/mudler/go-isterminal"
)

func main() {
    if terminal.IsTerminal(os.Stdout) {
        ....
    }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTerminal

func IsTerminal(w io.Writer) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL