terminal

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const TerminalInterruptCode = 130

TerminalInterruptCode is the exit status for interrupted prompts

Variables

This section is empty.

Functions

func CollectInput

func CollectInput(prompt *Prompt) (string, error)

CollectInput gathers a value for the prompt from flag, environment, or input

func CollectSelect

func CollectSelect(prompt Prompt) (int, error)

CollectSelect gathers the index of the selected value for a prompt

Types

type Prompt

type Prompt struct {
	Message     string     // Promptful message for the input
	Flag        *flag.Flag // Substituting flag, preferred if set
	Environment string     // Related environment variable name

	Options      []string // Available selection options
	Descriptions []string // Optional option descriptions
	Hidden       bool     // Mask any text inputs
}

Prompt holds the information needed for gathering inputs

Jump to

Keyboard shortcuts

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