Help us shape the future of Go! Take the 2026 Go Developer Survey

tty

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2021 License: MIT Imports: 1 Imported by: 3

README

tty

Godoc Report Tests Coverage Sponsor

Terminal detection for Go.

API

isTerminal := tty.IsTerminal(os.Stdout.Fd())

Authors

  • Yasuhiro Matsumoto (a.k.a mattn)
  • Eduard Urbach (minor modifications)

Style

Please take a look at the style guidelines if you'd like to make a pull request.

Sponsors

Cedric Fung Scott Rayapoullé Eduard Urbach
Cedric Fung Scott Rayapoullé Eduard Urbach

Want to see your own name here?

Documentation

Overview

Example
package main

import (
	"fmt"
	"os"

	"github.com/akyoto/tty"
)

func main() {
	if tty.IsTerminal(os.Stdout.Fd()) {
		fmt.Println("Is a terminal")
	} else {
		fmt.Println("Is not a terminal")
	}
}

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTerminal

func IsTerminal(fd uintptr) bool

IsTerminal return true if the file descriptor is a terminal.

Types

This section is empty.

Jump to

Keyboard shortcuts

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