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 modules, 3 packages

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.

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
⌂ 换网址