Commit ca436f4b authored by Péter Szilágyi's avatar Péter Szilágyi Committed by GitHub

Merge pull request #14897 from karalabe/cardinal-sin

cmd/puppeth: remove wrapping loop in single reads
parents 350bb6d9 455fcc83
...@@ -106,7 +106,6 @@ func (w *wizard) readString() string { ...@@ -106,7 +106,6 @@ func (w *wizard) readString() string {
// readDefaultString reads a single line from stdin, trimming if from spaces. If // readDefaultString reads a single line from stdin, trimming if from spaces. If
// an empty line is entered, the default value is returned. // an empty line is entered, the default value is returned.
func (w *wizard) readDefaultString(def string) string { func (w *wizard) readDefaultString(def string) string {
for {
fmt.Printf("> ") fmt.Printf("> ")
text, err := w.in.ReadString('\n') text, err := w.in.ReadString('\n')
if err != nil { if err != nil {
...@@ -116,7 +115,6 @@ func (w *wizard) readDefaultString(def string) string { ...@@ -116,7 +115,6 @@ func (w *wizard) readDefaultString(def string) string {
return text return text
} }
return def return def
}
} }
// readInt reads a single line from stdin, trimming if from spaces, enforcing it // readInt reads a single line from stdin, trimming if from spaces, enforcing it
...@@ -207,7 +205,6 @@ func (w *wizard) readDefaultFloat(def float64) float64 { ...@@ -207,7 +205,6 @@ func (w *wizard) readDefaultFloat(def float64) float64 {
// readPassword reads a single line from stdin, trimming it from the trailing new // readPassword reads a single line from stdin, trimming it from the trailing new
// line and returns it. The input will not be echoed. // line and returns it. The input will not be echoed.
func (w *wizard) readPassword() string { func (w *wizard) readPassword() string {
for {
fmt.Printf("> ") fmt.Printf("> ")
text, err := terminal.ReadPassword(int(syscall.Stdin)) text, err := terminal.ReadPassword(int(syscall.Stdin))
if err != nil { if err != nil {
...@@ -215,7 +212,6 @@ func (w *wizard) readPassword() string { ...@@ -215,7 +212,6 @@ func (w *wizard) readPassword() string {
} }
fmt.Println() fmt.Println()
return string(text) return string(text)
}
} }
// readAddress reads a single line from stdin, trimming if from spaces and converts // readAddress reads a single line from stdin, trimming if from spaces and converts
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment