prompts

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: MIT Imports: 15 Imported by: 0

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"
)

Variables

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

Errors

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 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 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