AlecAivazis / survey

A golang library for building interactive and accessible prompts with full support for windows and posix terminals.
MIT License
4.08k stars 350 forks source link

survey: prevent panic on nil AskOpt #243

Closed orymate closed 5 years ago

orymate commented 5 years ago

nils may remain from v1 code, and not trivial to find. Also, dynamic generation of optional requirements is more complex than needed this way:

opts := []survey.AskOpt{}
if required {
    opts = append(opts, survey.WithValidator(survey.Required))
}
survey.AskOne(input, &output, opts...)
AlecAivazis commented 5 years ago

Thanks for the contribution! I can see how this would be useful for migrating from v1 -> v2 :+1:

AlecAivazis commented 5 years ago

I'm not sure why the build is failing. I thought this was fixed in #239