gilo/terminal/io.go
Timothy Warren 41d1aa6553
All checks were successful
timw4mail/gilo/pipeline/head This commit looks good
Insert a char
2021-04-01 16:17:13 -04:00

30 lines
399 B
Go

package terminal
import (
"bufio"
"fmt"
"os"
)
var reader = bufio.NewReader(os.Stdin)
func ReadKey() (rune, int) {
ch, size, err := reader.ReadRune()
if err != nil {
panic(err)
}
return ch, size
}
// Print string to stdout
func Write(s string, a ...interface{}) {
fmt.Printf(s, a...)
}
func WriteLn(s string, a ...interface{}) {
str := fmt.Sprintf(s, a...)
Write("%s\r\n", str)
}