You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
454 B
Go
22 lines
454 B
Go
package cmdline
|
|
|
|
import (
|
|
"bufio"
|
|
"fmt"
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
// EnterToContinue let stdin waiting for an enter key to continue.
|
|
func EnterToContinue() {
|
|
fmt.Print("Press 'Enter' to continue...")
|
|
bufio.NewReader(os.Stdin).ReadBytes('\n')
|
|
}
|
|
|
|
// ReadLine shows prompt to stdout and read a line from stdin.
|
|
func ReadLine(prompt string) string {
|
|
fmt.Print(prompt)
|
|
input, _ := bufio.NewReader(os.Stdin).ReadString('\n')
|
|
return strings.TrimSpace(input)
|
|
}
|