AlecAivazis / survey

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

Select item by index in `Select` programatically? #438

Closed metafates closed 1 year ago

metafates commented 1 year ago

Something like

prompt := survey.Select{
    Message:  "...",
    Options:  options,
}

prompt.Select(4)

Is is possible somehow?

metafates commented 1 year ago

Appears to be possible with Default field. 😬

prompt := survey.Select{
    Message:  "...",
    Options:  options,
        Default: options[4]
}