Extract line reading into util func

This commit is contained in:
Marcin Kulik
2014-08-03 20:57:15 +02:00
parent 9591c79a0d
commit 834f747ebd
2 changed files with 12 additions and 2 deletions

View File

@@ -1,7 +1,6 @@
package commands
import (
"bufio"
"bytes"
"flag"
"fmt"
@@ -58,7 +57,7 @@ func (c *RecordCommand) Execute(args []string) error {
util.Warningf("Current terminal size is %vx%v.", cols, rows)
util.Warningf("It may be too big to be properly replayed on smaller screens.")
util.Warningf("You can now resize it. Press <Enter> to start recording.")
bufio.NewReader(os.Stdin).ReadString('\n')
util.ReadLine()
}
util.Printf("Asciicast recording started.")

11
util/readline.go Normal file
View File

@@ -0,0 +1,11 @@
package util
import (
"bufio"
"os"
)
func ReadLine() string {
s, _ := bufio.NewReader(os.Stdin).ReadString('\n')
return s
}