terminal

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClosablePromptInput

type ClosablePromptInput struct {
	io.ReadCloser
	// contains filtered or unexported fields
}

ClosablePromptInput wraps an io.ReadCloser into PromptInput.

func (*ClosablePromptInput) Close

func (i *ClosablePromptInput) Close() error

Close closes the underlying ReadCloser.

func (*ClosablePromptInput) Interrupt

func (i *ClosablePromptInput) Interrupt() error

Interrupt closes the underlying ReadCloser once.

type PromptInput

type PromptInput interface {
	io.ReadCloser
	Interrupt() error
}

PromptInput wraps an interruptible input stream.

func DuplicatePromptInput

func DuplicatePromptInput(input io.Reader) (PromptInput, error)

DuplicatePromptInput duplicates an input stream and equips it with an interrupt pipe.

type Prompter

type Prompter interface {
	ReadLine(ctx context.Context, prompt string) (string, error)
	ReadSecret(ctx context.Context, prompt string) (string, error)
}

Prompter provides interruptible terminal input for lines and secrets. ReadLine echoes console text and accepts Enter on Windows; ReadSecret never echoes secret input. Redirected streams are read without terminal echo.

func NewPrompter

func NewPrompter(stdin io.Reader, stdout io.Writer) Prompter

NewPrompter creates a Prompter backed by stdin and stdout.

Jump to

Keyboard shortcuts

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