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

term

package
v0.30.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package term reports whether stackit is attached to an interactive terminal and holds the process-wide interactive mode.

Index

Constants

This section is empty.

Variables

View Source
var ErrInteractiveDisabled = errors.New("interactive prompts are disabled (running with --no-interactive or not in a TTY)")

ErrInteractiveDisabled is returned when interactive prompts are disabled (running with --no-interactive or not in a TTY).

Functions

func CheckInteractiveAllowed

func CheckInteractiveAllowed() error

CheckInteractiveAllowed returns ErrInteractiveDisabled when interactive prompts are not available, and nil otherwise.

func IsInteractive

func IsInteractive() bool

IsInteractive reports whether prompts and the TUI may be used: interactive mode is on and a usable terminal is attached.

func NonInteractiveEnv

func NonInteractiveEnv() bool

NonInteractiveEnv reports whether STACKIT_NO_INTERACTIVE requests non-interactive mode. Any value other than empty/"0"/"false"/"no" enables it, letting agents and scripts opt out of prompts once instead of passing --no-interactive on every command.

func ReadStdin

func ReadStdin() (string, error)

ReadStdin reads all piped standard input. It returns "" without blocking when stdin is a terminal or an empty file.

func SetInteractive

func SetInteractive(interactive bool)

SetInteractive sets whether the TUI should be interactive

func TerminalDetected

func TerminalDetected() bool

TerminalDetected reports whether a usable interactive terminal is attached, independent of the configured interactive mode. It checks the TERM environment, stdin/stdout isatty, and /dev/tty availability. Use this when resolving the default interactivity before the interactive mode is set (e.g. in the root command), where IsTTY's mode gate would not yet apply.

Types

This section is empty.

Jump to

Keyboard shortcuts

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