fix bug with Prompter.MultiSelect

This commit is contained in:
vilmibm 2023-03-09 15:36:15 -08:00 committed by Nate Smith
parent b5c3d982b1
commit 10dd74b4af
2 changed files with 5 additions and 5 deletions

View file

@ -13,7 +13,7 @@ import (
//go:generate moq -rm -out prompter_mock.go . Prompter
type Prompter interface {
Select(string, string, []string) (int, error)
MultiSelect(string, string, []string) (int, error)
MultiSelect(string, string, []string) ([]string, error)
Input(string, string) (string, error)
InputHostname() (string, error)
Password(string) (string, error)
@ -72,7 +72,7 @@ func (p *surveyPrompter) Select(message, defaultValue string, options []string)
return
}
func (p *surveyPrompter) MultiSelect(message, defaultValue string, options []string) (result int, err error) {
func (p *surveyPrompter) MultiSelect(message, defaultValue string, options []string) (result []string, err error) {
q := &survey.MultiSelect{
Message: message,
Options: options,

View file

@ -35,7 +35,7 @@ var _ Prompter = &PrompterMock{}
// MarkdownEditorFunc: func(s1 string, s2 string, b bool) (string, error) {
// panic("mock out the MarkdownEditor method")
// },
// MultiSelectFunc: func(s1 string, s2 string, strings []string) (int, error) {
// MultiSelectFunc: func(s1 string, s2 string, strings []string) ([]string, error) {
// panic("mock out the MultiSelect method")
// },
// PasswordFunc: func(s string) (string, error) {
@ -70,7 +70,7 @@ type PrompterMock struct {
MarkdownEditorFunc func(s1 string, s2 string, b bool) (string, error)
// MultiSelectFunc mocks the MultiSelect method.
MultiSelectFunc func(s1 string, s2 string, strings []string) (int, error)
MultiSelectFunc func(s1 string, s2 string, strings []string) ([]string, error)
// PasswordFunc mocks the Password method.
PasswordFunc func(s string) (string, error)
@ -348,7 +348,7 @@ func (mock *PrompterMock) MarkdownEditorCalls() []struct {
}
// MultiSelect calls MultiSelectFunc.
func (mock *PrompterMock) MultiSelect(s1 string, s2 string, strings []string) (int, error) {
func (mock *PrompterMock) MultiSelect(s1 string, s2 string, strings []string) ([]string, error) {
if mock.MultiSelectFunc == nil {
panic("PrompterMock.MultiSelectFunc: method is nil but Prompter.MultiSelect was just called")
}