term

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTerminal

func IsTerminal(f *os.File) bool

IsTerminal reports whether f is connected to a terminal (character device).

func ReadPassword

func ReadPassword(f *os.File) (string, error)

ReadPassword reads a line from f without echoing it to the terminal, for prompting secrets (e.g. API tokens). The trailing newline the user types is not echoed either, so a newline is emitted to stdout afterward to move the cursor to the next line. The returned string excludes the line terminator.

f must be a terminal; callers should gate on IsTerminal before prompting.

Types

type Spinner

type Spinner struct {
	// contains filtered or unexported fields
}

Spinner shows a status line on stderr while a long-running operation is in progress. If stderr is not a terminal, all methods are silent no-ops.

func NewSpinner

func NewSpinner(label string) *Spinner

NewSpinner creates a spinner that will display label on stderr. If stderr is not a TTY the spinner is inert.

func (*Spinner) Start

func (s *Spinner) Start()

Start begins displaying the spinner. Safe to call on an inert spinner.

func (*Spinner) Stop

func (s *Spinner) Stop()

Stop clears the spinner line and releases the goroutine. Safe to call multiple times or on an inert spinner.

Jump to

Keyboard shortcuts

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