63 lines
1.0 KiB
Go
63 lines
1.0 KiB
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"os"
|
||
|
"os/exec"
|
||
|
)
|
||
|
|
||
|
func doItRaw() {
|
||
|
rawMode := exec.Command("/bin/stty", "raw", "-echo")
|
||
|
rawMode.Stdin = os.Stdin
|
||
|
err := rawMode.Run()
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func cook() {
|
||
|
cookedMode := exec.Command("/bin/stty", "-raw", "echo")
|
||
|
cookedMode.Stdin = os.Stdin
|
||
|
err := cookedMode.Run()
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func clearEOL() {
|
||
|
os.Stdout.Write([]byte{0x1b, 0x5b, 0x4b})
|
||
|
}
|
||
|
|
||
|
func clear() {
|
||
|
os.Stdout.Write([]byte{0x1b, 0x5b, 0x48, 0x1b, 0x5b, 0x32, 0x4a, 0x1b, 0x5b, 0x33, 0x4a})
|
||
|
}
|
||
|
|
||
|
func goUp() {
|
||
|
os.Stdout.Write([]byte{0x1b, 0x5b, 0x41})
|
||
|
}
|
||
|
|
||
|
func goLeft() {
|
||
|
os.Stdout.Write([]byte{0x08})
|
||
|
}
|
||
|
|
||
|
// func save() {
|
||
|
// cmd := exec.Command("tput", "sc")
|
||
|
// cmd.Stdin = os.Stdin
|
||
|
// cmd.Stdout = os.Stdout
|
||
|
// cmd.Stderr = os.Stderr
|
||
|
// err := cmd.Run()
|
||
|
// if err != nil {
|
||
|
// panic(err)
|
||
|
// }
|
||
|
// }
|
||
|
|
||
|
// func restore() {
|
||
|
// cmd := exec.Command("tput", "rc")
|
||
|
// cmd.Stdin = os.Stdin
|
||
|
// cmd.Stdout = os.Stdout
|
||
|
// cmd.Stderr = os.Stderr
|
||
|
// err := cmd.Run()
|
||
|
// if err != nil {
|
||
|
// panic(err)
|
||
|
// }
|
||
|
// }
|