prompt

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package prompt provides small interactive command-line prompt helpers for jugctl commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Prompter

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

Prompter reads prompts from in and writes them to out, defaulting to os.Stdin and os.Stdout when constructed via New.

func New

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

New returns a Prompter reading from in and writing prompts to out.

func (*Prompter) Confirm

func (p *Prompter) Confirm(label string) (bool, error)

Confirm asks a yes/no question, defaulting to No on empty input. Only "y" or "yes" (case-insensitive) are treated as confirmation.

func (*Prompter) RequiredText

func (p *Prompter) RequiredText(label string) (string, error)

RequiredText prompts for a line of input, re-asking until a non-empty value is entered.

func (*Prompter) Select

func (p *Prompter) Select(label string, options []string) (string, error)

Select prompts the user to choose one of options, listing them as numbered choices, and returns the chosen option. It re-asks on an invalid or out-of-range selection.

func (*Prompter) Text

func (p *Prompter) Text(label, defaultValue string) (string, error)

Text prompts for a line of input, returning defaultValue if the user enters nothing. If defaultValue is empty, the prompt is shown without a default hint.

Source Files

  • prompt.go

Jump to

Keyboard shortcuts

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