Files
jira/vendor/github.com/AlecAivazis/survey/tests/doubleSelect.go
T
2017-08-13 18:23:38 -07:00

43 lines
686 B
Go

package main
import (
"fmt"
"github.com/AlecAivazis/survey"
)
var simpleQs = []*survey.Question{
{
Name: "color",
Prompt: &survey.Select{
Message: "select1:",
Options: []string{"red", "blue", "green"},
},
Validate: survey.Required,
},
{
Name: "color2",
Prompt: &survey.Select{
Message: "select2:",
Options: []string{"red", "blue", "green"},
},
Validate: survey.Required,
},
}
func main() {
answers := struct {
Color string
Color2 string
}{}
// ask the question
err := survey.Ask(simpleQs, &answers)
if err != nil {
fmt.Println(err.Error())
return
}
// print the answers
fmt.Printf("%s and %s.\n", answers.Color, answers.Color2)
}