Don't make variables required
Signed-off-by: jolheiser <john.olheiser@gmail.com>pull/7/head v0.0.3
parent
cae16cdbdc
commit
dc19c1b993
|
@ -14,7 +14,7 @@ var (
|
|||
destDir string
|
||||
reg *Registry
|
||||
|
||||
tmplContents = `{{title name}} {{year}}`
|
||||
tmplContents = `{{title name}} {{.year}}`
|
||||
tmplTemplate = `name = "john olheiser"
|
||||
year = 2020`
|
||||
tmplGold = "John Olheiser 2020"
|
||||
|
|
|
@ -135,20 +135,11 @@ func prompt(dir string, defaults bool) (map[string]interface{}, error) {
|
|||
Default: fmt.Sprintf("%v", t),
|
||||
}
|
||||
}
|
||||
q := []*survey.Question{
|
||||
{
|
||||
Name: "response",
|
||||
Prompt: p,
|
||||
Validate: survey.Required,
|
||||
},
|
||||
}
|
||||
a := struct {
|
||||
Response string
|
||||
}{}
|
||||
if err := survey.Ask(q, &a); err != nil {
|
||||
var a string
|
||||
if err := survey.AskOne(p, &a); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
vars[k] = a.Response
|
||||
vars[k] = a
|
||||
}
|
||||
|
||||
return vars, nil
|
||||
|
|
Loading…
Reference in New Issue