From f70957bfaaf4cbdd462b8f722066fa0ac31f5e1a Mon Sep 17 00:00:00 2001 From: mitchell Date: Mon, 16 Dec 2024 15:07:50 -0500 Subject: [PATCH] Force prompt option should override non-interactive option. --- internal/prompt/prompt.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/internal/prompt/prompt.go b/internal/prompt/prompt.go index d1db14cb01..4ae16f9ef5 100644 --- a/internal/prompt/prompt.go +++ b/internal/prompt/prompt.go @@ -129,9 +129,7 @@ func (p *Prompt) InputAndValidate(title, message string, defaultResponse *string if nonInteractiveResponse == nil { return "", ErrNoForceOption } - } - - if !p.isInteractive { + } else if !p.isInteractive { nonInteractiveResponse = defaultResponse if nonInteractiveResponse == nil { return "", interactiveInputError(message) @@ -194,9 +192,7 @@ func (p *Prompt) Select(title, message string, choices []string, defaultChoice * if nonInteractiveChoice == nil { return "", ErrNoForceOption } - } - - if !p.isInteractive { + } else if !p.isInteractive { nonInteractiveChoice = defaultChoice if nonInteractiveChoice == nil { return "", interactiveInputError(message) @@ -253,9 +249,7 @@ func (p *Prompt) Confirm(title, message string, defaultChoice *bool, forcedChoic if nonInteractiveChoice == nil { return false, ErrNoForceOption } - } - - if !p.isInteractive { + } else if !p.isInteractive { nonInteractiveChoice = defaultChoice if nonInteractiveChoice == nil { return false, interactiveInputError(message)