Skip to content

Commit

Permalink
Force prompt option should override non-interactive option.
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchell-as committed Dec 16, 2024
1 parent 63973c6 commit f70957b
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions internal/prompt/prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit f70957b

Please sign in to comment.