add prompt.StubConfirm

This commit is contained in:
vilmibm 2020-07-27 10:00:19 -05:00
parent 4c57566cdc
commit dadcf4ba96
2 changed files with 15 additions and 24 deletions

View file

@ -2,6 +2,17 @@ package prompt
import "github.com/AlecAivazis/survey/v2"
func StubConfirm(result bool) func() {
orig := Confirm
Confirm = func(_ string, r *bool) error {
*r = result
return nil
}
return func() {
Confirm = orig
}
}
var Confirm = func(prompt string, result *bool) error {
p := &survey.Confirm{
Message: prompt,