From 730965c3a849a04566be0e60b61f13e585aa03c5 Mon Sep 17 00:00:00 2001 From: Denis Gukov Date: Wed, 11 Aug 2021 22:19:07 +0500 Subject: [PATCH] fix(be): default values for setup --- cli/setup/setup.go | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/cli/setup/setup.go b/cli/setup/setup.go index a8e92bf54..c9e0de578 100644 --- a/cli/setup/setup.go +++ b/cli/setup/setup.go @@ -150,27 +150,9 @@ func askValue(prompt string, defaultValue string, item interface{}) { } fmt.Print(": ") + _, _ = fmt.Sscanln(defaultValue, item) + scanErrorChecker(fmt.Scanln(item)) - //str, err := stdin.ReadString('\n') - //if err != nil { - // log.WithFields(log.Fields{"level": "Warn"}).Warn(err.Error()) - //} - - // Remove newlines - //str = strings.TrimSuffix(str, "\n") - //str = strings.TrimSuffix(str, "\r") - // - //// If default, print default on input line - //if len(str) == 0 { - // str = defaultValue - // fmt.Print("\033[1A") - // fmt.Println("> " + defaultValue) - //} - // - ////Parse - //if _, err := fmt.Sscanln(str, item); err != nil && err != io.EOF { - // log.WithFields(log.Fields{"level": "Warn"}).Warn(err.Error()) - //} // Empty line after prompt fmt.Println("")