isatty

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2023 License: MIT Imports: 4 Imported by: 9

README

isatty

Go Reference Go Report Card

Determine whether the stream is a tty.

Features

  • Supports most platforms

  • Supports force override using environment variable FORCE_TTY

Install

go get gopkg.ilharper.com/x/isatty

Usage

import "gopkg.ilharper.com/x/isatty"

if isatty.Isatty(os.Stdout.Fd()) {
	// TTY
} else {
	// Not TTY
}

Go Reference

Using FORCE_TTY

User can override the result using the environment variable FORCE_TTY.

# Force TTY
FORCE_TTY=
FORCE_TTY=1
FORCE_TTY=true

# Force not TTY
FORCE_TTY=0
FORCE_TTY=false

LICENSE

MIT

Documentation

Overview

Package isatty determine whether the stream is a tty.

Features

- Supports most platforms - Supports force override using environment variable `FORCE_TTY`

Usage

import "gopkg.ilharper.com/x/isatty"

if isatty.Isatty(os.Stdout.Fd()) {
    // TTY
} else {
    // Not TTY
}

Using `FORCE_TTY`

User can override the result using the environment variable `FORCE_TTY`.

# Force TTY
FORCE_TTY=
FORCE_TTY=1
FORCE_TTY=true

# Force not TTY
FORCE_TTY=0
FORCE_TTY=false

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Isatty

func Isatty(fd uintptr) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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