termutil

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: AGPL-3.0, AGPL-3.0-only Imports: 5 Imported by: 0

Documentation

Overview

Package termutil detects terminal constraints for output layout. It owns one thing: translating a writer into a content width budget.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContentWidth

func ContentWidth(w io.Writer) int

ContentWidth returns the usable content width for rows written to w.

Detection order:

  1. Terminal size from w if it is an *os.File connected to a TTY.
  2. $COLUMNS env var — set by most shells, survives pipes and subshells.
  3. layout.DefaultContentWidth — safe fallback for CI pipes and file output.

Width is derived from w itself first so it behaves correctly when output is redirected or captured, while $COLUMNS provides the actual terminal hint when the writer is a pipe (e.g. `stagefreight ci run docs | tee log.txt`).

Types

This section is empty.

Jump to

Keyboard shortcuts

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