Skip to content

Commit

Permalink
Merge pull request #147 from nao1215/fix/issue146
Browse files Browse the repository at this point in the history
Fix issue148: Confirmation with [Y/n] should default to "yes"
  • Loading branch information
nao1215 authored May 8, 2024
2 parents d398568 + 36a7cfb commit 7dbeb57
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/print/print.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ func Question(ask string) bool {
cmdinfo.Name, color.GreenString("CHECK"), ask+" [Y/n] ")
_, err := FmtScanln(&response)
if err != nil {
// If user input only enter.
// If user input only enter, [Y/n] syntax is commonly used to denote that
// "yes" is the default.
// https://github.com/nao1215/gup/issues/146
if strings.Contains(err.Error(), "expected newline") {
return Question(ask)
return true
}
fmt.Fprint(os.Stderr, err.Error())
return false
Expand Down

0 comments on commit 7dbeb57

Please sign in to comment.