Helpers ----------------------------------------------------------------
(out io.Writer, in *bufio.Reader, prompt, def string)
| 260 | // Helpers ---------------------------------------------------------------- |
| 261 | |
| 262 | func promptLine(out io.Writer, in *bufio.Reader, prompt, def string) string { |
| 263 | fmt.Fprint(out, prompt) |
| 264 | line, err := in.ReadString('\n') |
| 265 | if err != nil { |
| 266 | return def |
| 267 | } |
| 268 | line = strings.TrimSpace(line) |
| 269 | if line == "" { |
| 270 | return def |
| 271 | } |
| 272 | return line |
| 273 | } |
| 274 | |
| 275 | func promptYesNo(out io.Writer, in *bufio.Reader, prompt string, def bool) bool { |
| 276 | suffix := " (Y/n) " |