Skip to content

Commit 7dbeb57

Browse files
authored
Merge pull request #147 from nao1215/fix/issue146
Fix issue148: Confirmation with [Y/n] should default to "yes"
2 parents d398568 + 36a7cfb commit 7dbeb57

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

internal/print/print.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,11 @@ func Question(ask string) bool {
6161
cmdinfo.Name, color.GreenString("CHECK"), ask+" [Y/n] ")
6262
_, err := FmtScanln(&response)
6363
if err != nil {
64-
// If user input only enter.
64+
// If user input only enter, [Y/n] syntax is commonly used to denote that
65+
// "yes" is the default.
66+
// https://github.com/nao1215/gup/issues/146
6567
if strings.Contains(err.Error(), "expected newline") {
66-
return Question(ask)
68+
return true
6769
}
6870
fmt.Fprint(os.Stderr, err.Error())
6971
return false

0 commit comments

Comments
 (0)