You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zk/adapter/term/prompt.go

21 lines
434 B
Go

package term
import (
survey "github.com/AlecAivazis/survey/v2"
)
// Confirm is a shortcut to prompt a yes/no question to the user.
func (t *Terminal) Confirm(msg string, defaultAnswer bool) (confirmed, skipped bool) {
if !t.IsInteractive() {
return defaultAnswer, true
}
confirmed = false
prompt := &survey.Confirm{
Message: msg,
Default: defaultAnswer,
}
survey.AskOne(prompt, &confirmed)
return confirmed, false
}