This commit is contained in:
cui 2026-05-24 11:34:34 +08:00 committed by GitHub
commit d7c4b6a0b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -143,10 +143,13 @@ func (p *terminalPrompter) PromptPassword(prompt string) (passwd string, err err
// choice to be made, returning that choice. // choice to be made, returning that choice.
func (p *terminalPrompter) PromptConfirm(prompt string) (bool, error) { func (p *terminalPrompter) PromptConfirm(prompt string) (bool, error) {
input, err := p.PromptInput(prompt + " [y/n] ") input, err := p.PromptInput(prompt + " [y/n] ")
if err != nil {
return false, err
}
if len(input) > 0 && strings.EqualFold(input[:1], "y") { if len(input) > 0 && strings.EqualFold(input[:1], "y") {
return true, nil return true, nil
} }
return false, err return false, nil
} }
// SetHistory sets the input scrollback history that the prompter will allow // SetHistory sets the input scrollback history that the prompter will allow