prompt

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2026 License: BlueOak-1.0.0 Imports: 7 Imported by: 0

Documentation

Overview

internal/prompt/prompt.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Confirm

func Confirm(prompt string, defaultValue bool) (bool, error)

Confirm prompts the user for a yes/no confirmation. Returns the defaultValue if not in an interactive terminal.

func EditInEditor

func EditInEditor(text string) (string, error)

EditInEditor opens the given text in the user's preferred editor and returns the edited content. Uses $VISUAL, then $EDITOR, then falls back to "vi". If stdin is not a TTY, returns the original text without editing.

func Input

func Input(prompt, defaultValue string) (string, error)

Input prompts the user for a single line of input with a default value. If the user enters nothing (just presses Enter), the default is returned. If not in an interactive terminal, the default is returned without prompting.

func IsInteractive

func IsInteractive() bool

IsInteractive returns true if stdout is connected to a terminal. Respects GH_FORCE_TTY, NO_COLOR, CLICOLOR, and CLICOLOR_FORCE environment variables for consistency with the gh CLI.

func Select

func Select(prompt string, options []string, defaultIndex int) (int, error)

Select prompts the user to choose from a list of options using arrow keys. Returns the index of the selected option (0-based). If not in an interactive terminal, returns the defaultIndex.

Types

This section is empty.

Jump to

Keyboard shortcuts

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