prompt

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 7 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

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