gilo/gilo.go

41 lines
501 B
Go
Raw Normal View History

2021-03-18 16:30:04 -04:00
package main
import (
2021-03-18 19:15:19 -04:00
"bufio"
"fmt"
2021-03-18 16:30:04 -04:00
"golang.org/x/term"
"os"
)
func goRaw() (*term.State, error) {
2021-03-18 19:15:19 -04:00
state, err := term.MakeRaw(int(os.Stdin.Fd()))
return state, err
2021-03-18 16:30:04 -04:00
}
func main() {
oldState, err := goRaw()
if err != nil {
panic(err)
}
defer term.Restore(int(os.Stdin.Fd()), oldState)
2021-03-18 19:15:19 -04:00
reader := bufio.NewReader(os.Stdin)
for {
char, _, err := reader.ReadRune()
if err != nil {
panic(err)
}
switch {
}
if char == 'q' {
fmt.Println("bye!\r")
return
}
}
2021-03-18 16:30:04 -04:00
}