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

Typo of a function signature in Readme #244

Closed manawasp closed 5 years ago

manawasp commented 5 years ago

Hello,

Just to let you know there is a small typo in the example from the README.md. Line 261:

func myFilter(filterValue string, optValue string, optIndex int) include bool {
    // only include the option if it includes the filter and has length greater than 5
    return strings.Contains(optValue, filterValue) && len(optValue) >= 5
}

// configure it for a specific prompt
&Select{
    Message: "Choose a color:",
    Options: []string{"red", "blue", "green"},
    Filter: myFilter,
}

// or define a default for all of the questions
survey.AskOne(prompt, &color, survey.WithFilter(myFilter))

The function signature should be ...) bool { not ...) include bool {

Thanks again for your work!

AlecAivazis commented 5 years ago

Whoops!! Good catch.

I am away from my computer for a few days but if you wanted to open a PR with that change, I can easily review it from my phone and get it merged. Otherwise I’ll try to remember to fix it when I get back.