terminal

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 12 Imported by: 0

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