terminal

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package terminal handles all user-facing I/O: status messages, prompts, and error formatting. Internal packages must never write to stdout/stderr directly — they return errors, and this package handles presentation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Confirm

func Confirm(prompt string, defaultYes bool) bool

Confirm asks a yes/no question on stdout and reads the answer from stdin. Returns defaultYes when the user presses Enter without typing anything.

func Fatal

func Fatal(format string, args ...any)

Fatal prints an error to stderr and exits with code 1. Only cmd/ned should call this — internal packages must return errors instead.

func PrintUsage

func PrintUsage()

PrintUsage writes the ned usage string to stderr.

func PromptPassword

func PromptPassword(prompt string) (string, error)

PromptPassword writes prompt and reads a password without echoing characters. Uses golang.org/x/term on real terminals, falls back to plain Scanln on non-TTY input (pipes, CI, scripted use).

func Status

func Status(format string, args ...any)

Status prints a progress message to stdout prefixed with "→".

func Success

func Success(format string, args ...any)

Success prints a completion message to stdout prefixed with "✓".

func Warn

func Warn(format string, args ...any)

Warn prints a non-fatal warning to stderr prefixed with "⚠".

Types

This section is empty.

Jump to

Keyboard shortcuts

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