terminal

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package terminal provides terminal detection utilities.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsInteractive

func IsInteractive() bool

IsInteractive determines if the current process is running in an interactive terminal.

Returns true if both stdin and stdout are connected to a terminal (TTY). Returns false if either is redirected to a file or pipe.

This is useful for deciding whether to prompt the user for input or fall back to non-interactive behavior.

Example
interactive := IsInteractive()

// Check interactivity before deciding how to proceed
_ = interactive
Example (ConditionalPrompt)
var input string
if IsInteractive() {
	// Prompt user
	input = "user-provided-value"
} else {
	// Use default
	input = "default-value"
}
_ = input

Types

This section is empty.

Jump to

Keyboard shortcuts

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