Open patrick-hermann-sva opened 3 years ago
@patrick-hermann-sva i use something like this for multiple prompts:
type CPrompt struct {
PUI promptui.Prompt
VarName string
}
var vars = map[string]string{}
var prompts = []CPrompt{
{
PUI: promptui.Prompt{
Label: "First Question",
},
VarName: "firstQ",
},
{
PUI: promptui.Prompt{
Label: "Second Question",
},
VarName: "secondQ",
},
}
for _, prompt := range prompts {
vars[prompt.VarName], _ = prompt.PUI.Run()
}
which will return an array like:
map[string]string{"firstQ":"test", "secondQ":"test"}
this is very bare-bones without any kind of validation passed but it can be easily extended to support validations.
is it possible w/ promptui to implement a series of prompts (like pass an array of multiple "question" objects)