prompt

package
v0.263.1 Latest Latest
Warning

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

Go to latest
Published: Jul 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

Overview

Package prompt provides consistent confirmation gates for destructive commands: interactive y/N (or type-to-confirm) on a terminal, and a required --force flag when running non-interactively so scripts fail safe.

Index

Constants

This section is empty.

Variables

View Source
var ErrAborted = errors.New("aborted")

ErrAborted is returned when the user declines a confirmation.

Functions

func Ask

func Ask(cmd *cobra.Command, question, def string) string

Ask prompts on a TTY for a line of text, showing def as the default. It returns def when the user presses enter on an empty line, or immediately (no prompt) when stdin is not a terminal — so non-interactive runs use defaults.

func AskSecret

func AskSecret(cmd *cobra.Command, question string) string

AskSecret prompts on a TTY for a secret without echoing it (via term.ReadPassword), so tokens never appear on screen or in scrollback. It returns "" when stdin is not a terminal — non-interactive runs should supply secrets via flags or stdin, not this prompt.

func Confirm

func Confirm(cmd *cobra.Command, question string, force bool) error

Confirm gates a destructive action with a y/N question. force (from --force) approves it unconditionally. Otherwise it prompts on a TTY (defaulting to no); with no TTY and no --force it refuses so piped/CI runs fail safe.

func ConfirmName

func ConfirmName(cmd *cobra.Command, action, expected string, force bool) error

ConfirmName gates a severe action (e.g. deleting a store and all its data) behind typing the resource's exact name. force skips it; a non-TTY without --force refuses.

Types

This section is empty.

Jump to

Keyboard shortcuts

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