Documentation ¶
Index ¶
- func NewEnvPrompt(config EnvConfig, store *Store) strumt.Prompter
- func NewEnvPrompts(configs []EnvConfig, store *Store) []strumt.Prompter
- func NewGroupEnvPromptWithCounter(configs []EnvConfig, store *Store) []strumt.Prompter
- func NewSwitchPrompt(ID string, choices []SwitchConfig) strumt.Prompter
- func ParseEnv(validator func(string) error, env string, defaultValue string, store *Store) func(value string) error
- type EnvConfig
- type GenericPrompt
- type Store
- type SwitchConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewEnvPrompt ¶
NewEnvPrompt creates a prompt to populate an environment variable
func NewEnvPrompts ¶
NewEnvPrompts creates several prompts at once to populate environments variables
func NewGroupEnvPromptWithCounter ¶
NewGroupEnvPromptWithCounter gives the ability to create several group of related environment variable, a common prefix provided as a number from an internal counter tied variable together. For instance in variables environments TEST_*_KEY and TEST_*_VALUE, * is replaced with a number, it becomes TEST_0_KEY and TEST_0_VALUE another call would give TEST_1_VALUE and TEST_1_KEY
func NewSwitchPrompt ¶
func NewSwitchPrompt(ID string, choices []SwitchConfig) strumt.Prompter
NewSwitchPrompt creates a new prompt used to provides several choices, like a menu can do
Types ¶
type EnvConfig ¶
type EnvConfig struct { ID string NextID string Env string PromptString string Validator func(value string) error DefaultValue string RunBeforeNextPrompt func(value string, store *Store) }
EnvConfig is common config for all environments variables prompts builder
type GenericPrompt ¶
type GenericPrompt struct { PromptID string PromptStr string OnSuccess func(string) string OnError func(error) string ParseValue func(string) error }
GenericPrompt defines a generic overridable prompt
func (*GenericPrompt) NextOnError ¶
func (t *GenericPrompt) NextOnError(err error) string
NextOnError returns an error when something wrong occurred
func (*GenericPrompt) NextOnSuccess ¶
func (t *GenericPrompt) NextOnSuccess(value string) string
NextOnSuccess returns the next prompt to reach when succeed
func (*GenericPrompt) Parse ¶
func (t *GenericPrompt) Parse(value string) error
Parse handles prompt value
func (*GenericPrompt) PromptString ¶
func (t *GenericPrompt) PromptString() string
PromptString returns string given by prompt
type SwitchConfig ¶
SwitchConfig provides a configuration to switch prompt