From 36a7cfb5c39af3dc5c818310c8a719dc7250c782 Mon Sep 17 00:00:00 2001 From: CHIKAMATSU Naohiro Date: Wed, 8 May 2024 19:48:54 +0900 Subject: [PATCH] defult value is yes --- internal/print/print.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/print/print.go b/internal/print/print.go index a2337cf..f3f6f80 100644 --- a/internal/print/print.go +++ b/internal/print/print.go @@ -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