prompt

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Confirm

func Confirm(in io.Reader, out io.Writer, prompt string, defaultYes bool) (bool, error)

Confirm asks a yes/no question. defaultYes controls the default when the user just presses Enter.

func Input

func Input(in io.Reader, out io.Writer, prompt string) (string, error)

Input reads a line of text from the user.

func Password

func Password(out io.Writer, prompt string) (string, error)

Password reads a line of input with echo disabled (masked). Falls back to regular input if the reader is not a terminal.

func Select

func Select(in io.Reader, out io.Writer, prompt string, options []string) (int, error)

Select presents a list of options and returns the index of the chosen one. The display uses the same style as GitHub CLI:

? What account do you want to log into?  [Use arrows to move, type to filter]
> GitHub.com
  GitHub Enterprise Server

Types

type Prompter

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

Prompter provides interactive terminal prompts.

func New

func New(in io.Reader, out io.Writer) *Prompter

New creates a Prompter that reads from in and writes to out.

Jump to

Keyboard shortcuts

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