prompt

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package prompt runs the review commands' forms, shared by review and its subcommands.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotPromptable is returned when nobody can answer the prompts.
	ErrNotPromptable = errors.NewSentinel("review.not_promptable", "review: an interactive terminal is needed")

	// ErrInputEnded is returned when piped input runs out mid-verdict. Nothing
	// is recorded: GTB reports the input running out as setup.ErrInputEnded,
	// and huh (v2.0.3) panics on an out-of-range choice there; either way the
	// answer is one nobody gave.
	ErrInputEnded = errors.NewSentinel("review.input_ended", "review: the input ended before a verdict was given")
)

Functions

func Check

func Check(streams props.IO) error

Check refuses streams nobody can answer prompts on.

Types

type Prompter

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

Prompter runs the forms, and in accessible mode knows when the input ended.

func New

func New(streams props.IO) Prompter

New returns a Prompter over streams. In accessible mode it watches stdin for its end, since that is where huh panics.

func (Prompter) Run

func (p Prompter) Run(ctx context.Context, form *huh.Form) (err error)

Run runs one form. Input that ran out is not an answer, and neither is the panic huh (v2.0.3) raises on an out-of-range choice at the end of input, which GTB's setup.RunFormOn (v0.46.0) does not catch (see ErrInputEnded).

Jump to

Keyboard shortcuts

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