2020-07-26 17:09:05 +08:00
|
|
|
package cmdline
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bufio"
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
2021-02-17 11:08:30 +08:00
|
|
|
// EnterToContinue let stdin waiting for an enter key to continue.
|
2020-07-26 17:09:05 +08:00
|
|
|
func EnterToContinue() {
|
|
|
|
fmt.Print("Press 'Enter' to continue...")
|
|
|
|
bufio.NewReader(os.Stdin).ReadBytes('\n')
|
|
|
|
}
|
|
|
|
|
2021-02-17 11:08:30 +08:00
|
|
|
// ReadLine shows prompt to stdout and read a line from stdin.
|
2020-07-26 17:09:05 +08:00
|
|
|
func ReadLine(prompt string) string {
|
|
|
|
fmt.Print(prompt)
|
|
|
|
input, _ := bufio.NewReader(os.Stdin).ReadString('\n')
|
|
|
|
return strings.TrimSpace(input)
|
|
|
|
}
|