-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
39 lines (35 loc) · 796 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package main
import (
"time"
"bytes"
"io"
"log"
"os"
"os/exec"
)
var (
moveCursorSeq = []byte{27, '[', ';', 'H'}
clearScreenSeq = []byte{27, '[', '2', 'J'}
)
func main() {
cmd := exec.Command("write", "matehegedus")
stdin, err := cmd.StdinPipe()
if err != nil {
log.Panic(err)
}
err = cmd.Start()
if err != nil {
log.Panic(err)
}
for i, frame := range frames {
defer stdin.Close()
io.Copy(stdin, bytes.NewBufferString("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"))
defer stdin.Close()
io.Copy(stdin, bytes.NewBufferString(frame))
time.Sleep(time.Duration(int64(repeats[i]) * 67e6))
}
}
func clearScreen() {
os.Stdout.Write(clearScreenSeq)
os.Stdout.Write(moveCursorSeq)
}