Don't make variables required

Signed-off-by: jolheiser <john.olheiser@gmail.com>
pull/7/head v0.0.3
jolheiser 2020-11-18 11:45:46 -06:00
parent cae16cdbdc
commit dc19c1b993
Signed by: jolheiser
GPG Key ID: B853ADA5DA7BBF7A
2 changed files with 4 additions and 13 deletions

View File

@ -14,7 +14,7 @@ var (
destDir string destDir string
reg *Registry reg *Registry
tmplContents = `{{title name}} {{year}}` tmplContents = `{{title name}} {{.year}}`
tmplTemplate = `name = "john olheiser" tmplTemplate = `name = "john olheiser"
year = 2020` year = 2020`
tmplGold = "John Olheiser 2020" tmplGold = "John Olheiser 2020"

View File

@ -135,20 +135,11 @@ func prompt(dir string, defaults bool) (map[string]interface{}, error) {
Default: fmt.Sprintf("%v", t), Default: fmt.Sprintf("%v", t),
} }
} }
q := []*survey.Question{ var a string
{ if err := survey.AskOne(p, &a); err != nil {
Name: "response",
Prompt: p,
Validate: survey.Required,
},
}
a := struct {
Response string
}{}
if err := survey.Ask(q, &a); err != nil {
return nil, err return nil, err
} }
vars[k] = a.Response vars[k] = a
} }
return vars, nil return vars, nil