mirror of
https://github.com/Threnklyn/jira.git
synced 2026-06-06 21:20:48 +02:00
rewrite checkpoint
This commit is contained in:
+43
@@ -0,0 +1,43 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/AlecAivazis/survey"
|
||||
)
|
||||
|
||||
// the questions to ask
|
||||
var simpleQs = []*survey.Question{
|
||||
{
|
||||
Name: "name",
|
||||
Prompt: &survey.Input{
|
||||
Message: "What is your name?",
|
||||
},
|
||||
Validate: survey.Required,
|
||||
},
|
||||
{
|
||||
Name: "color",
|
||||
Prompt: &survey.Select{
|
||||
Message: "Choose a color:",
|
||||
Options: []string{"red", "blue", "green"},
|
||||
},
|
||||
Validate: survey.Required,
|
||||
},
|
||||
}
|
||||
|
||||
func main() {
|
||||
answers := struct {
|
||||
Name string
|
||||
Color string
|
||||
}{}
|
||||
|
||||
// ask the question
|
||||
err := survey.Ask(simpleQs, &answers)
|
||||
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
// print the answers
|
||||
fmt.Printf("%s chose %s.\n", answers.Name, answers.Color)
|
||||
}
|
||||
Reference in New Issue
Block a user