prompts

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: BSD-3-Clause Imports: 16 Imported by: ? 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

Index

Constants

View Source
const (
	// Prompts
	BranchPrompt        = "Branch:"
	CommitMessagePrompt = "Commit Message:"
	DescriptionPrompt   = "Description:"
	EntryPointPrompt    = "Entry Point:"

	MemoryPrompt           = "Memory:"
	PathsPrompt            = "Paths [comma separated]:"
	SizePrompt             = "Size:"
	TTLPrompt              = "TTL:"
	UnitTypePrompt         = "Unit type:"
	TrueSelect             = "True"
	TrueSelectL            = "true"
	FalseSelect            = "False"
	FalseSelectL           = "false"
	TagsPrompt             = "Tags [comma separated]:"
	RegexPrompt            = "Use Regex For Match:"
	LocalPrompt            = "Local:"
	GenerateRepoPrompt     = "Generate a Repository:"
	UseTemplatePrompt      = "Use a Template:"
	SelectTemplatePrompt   = "Select a Template:"
	RepositoryNamePrompt   = "Repository Name:"
	RepositorySelectPrompt = "Select a Repository"
	ClonePrompt            = "Clone this Repository"
	Domains                = "Domains:"
	EmbedTokenPrompt       = "Embed Git Token Into Clone URL:"
	BranchSelectPrompt     = "Select a Branch:"
	PrivatePrompt          = "Private:"
	SourcePrompt           = "Code source:"
	CodeLanguagePrompt     = "Code Language:"
	CallPrompt             = "Entry Point:"
	TimeoutPrompt          = "Time To Live:"

	NetworkPrompts = "Network:"

	NoDomainGeneratePrompt = "No domains found, generate one?"

	// Error messages
	Required                   = "Required"
	MustBeABooleanValue        = "Must be a boolean value"
	FieldNotDefinedInConfig    = "field not defined in config: %#v"
	DoubleStringNotFound       = "%s %s not found"
	StringIsRequired           = "%s is required"
	StringIsNotAValidSelection = "`%s` not a valid selection: %v"
	InvalidSize                = "Invalid size: %s Ex:(10, 10GB, 10PB)"
	SelectPromptNoOptions      = "no options to select from for prompt: %s"
	NoServiceFromFlag          = "unable to find service with selection: (--%s %s)"

	//    Device Errors
	TagLessThanThreeCharacters = "Tags cannot be less than three characters"
)
View Source
const NonInteractiveEnvVar = "TAU_NON_INTERACTIVE"

NonInteractiveEnvVar is set (e.g. to "1") when the process should not use interactive prompts.

Variables

View Source
var (
	ErrNoServicesDefined = errors.New("no services defined in project config")
	ErrNoValidDomains    = errors.New("no valid domains")
)

Errors

View Source
var ErrNonInteractive = errors.New("cannot prompt: non-interactive mode (stdin not a TTY or " + NonInteractiveEnvVar + "/CI set); use command flags instead")

ErrNonInteractive is returned when a prompt would run but the environment is non-interactive. Callers should suggest using flags (e.g. "use --name, --provider, --token for login").

View Source
var PromptEnabled = true
View Source
var (
	SelectionNone = "(none)"
)

Functions

func Ask

func Ask(qs []*survey.Question, response interface{}, opts ...survey.AskOpt)

func AskOne

func AskOne(p survey.Prompt, response interface{}, opts ...survey.AskOpt)

func ConfirmPrompt

func ConfirmPrompt(label string) bool

func GetAString

func GetAString(c *cli.Context, field, prompt string, validator validateStringMethod, prev ...string) string

func GetOrAskForAStringValue

func GetOrAskForAStringValue(c *cli.Context, field string, label string, prev ...string) string

func GetOrAskForBool

func GetOrAskForBool(c *cli.Context, field string, label string, prev ...bool) bool

func GetOrAskForBoolDefaultTrue

func GetOrAskForBoolDefaultTrue(c *cli.Context, field string, label string, prev ...bool) bool

func GetOrAskForEnvironmentVars

func GetOrAskForEnvironmentVars(c *cli.Context, prev ...map[string]string) map[string]string

Unused, was used in devices

func GetOrAskForSelection

func GetOrAskForSelection(c *cli.Context, field string, label string, items []string, prev ...string) string

func GetOrRequireAString

func GetOrRequireAString(c *cli.Context, field, prompt string, validator validateStringMethod, prev ...string) string

func IsNonInteractive added in v1.1.10

func IsNonInteractive() bool

IsNonInteractive reports whether the CLI should avoid interactive prompts (TTY or env). When true, callers should return ErrNonInteractive or a wrapped error instead of prompting.

func MultiSelect

func MultiSelect(c *cli.Context, cnf MultiSelectConfig) (ret []string)

func PanicIfPromptNotEnabled

func PanicIfPromptNotEnabled(prompt string)

func RenderTable

func RenderTable(data [][]string)

func RenderTableWithMerge

func RenderTableWithMerge(data [][]string)

func RequiredString

func RequiredString(c *cli.Context, prompt string, f stringPromptMethod, prev ...string) string

func RequiredStringWithValidator

func RequiredStringWithValidator(c *cli.Context, prompt string, f stringPromptMethod, validator validateStringMethod, prev ...string) (ret string)

func SelectInterface

func SelectInterface(names []string, prompt, _default string) (selectedInterface string, err error)

func SelectInterfaceField

func SelectInterfaceField(ctx *cli.Context, options []string, field string, prompt string, prev ...string) (selected string, err error)

func ValidateOk

func ValidateOk(err error) bool

Types

type MultiSelectConfig

type MultiSelectConfig struct {
	Field    string
	Prompt   string
	Options  []string
	Previous []string
	Required bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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