1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
package main import ( "flag" "os" "golang.org/x/term" ) var file = flag.String("f", "cards", "cards file") func main() { flag.Parse() // Put terminal into raw mode oldState, err := term.MakeRaw(int(os.Stdin.Fd())) if err != nil { panic(err) } defer term.Restore(int(os.Stdin.Fd()), oldState) }