/
ci.go
49 lines (43 loc) · 1.09 KB
/
ci.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
40
41
42
43
44
45
46
47
48
49
package main
import (
"os"
"time"
"atomicgo.dev/keyboard"
"atomicgo.dev/keyboard/keys"
)
// ------ Automation for CI ------
// You can ignore this function, it is used to automatically run the demo and generate the example animation in our CI system.
func init() {
if os.Getenv("CI") == "true" {
go func() {
time.Sleep(time.Second)
input := "1111111\n2222222"
for _, r := range input {
if r == '\n' {
keyboard.SimulateKeyPress(keys.Enter)
} else {
keyboard.SimulateKeyPress(r)
}
time.Sleep(time.Millisecond * 250)
}
for i := 0; i < 7; i++ {
keyboard.SimulateKeyPress(keys.Left)
time.Sleep(time.Millisecond * 150)
}
keyboard.SimulateKeyPress(keys.Backspace)
time.Sleep(time.Millisecond * 500)
keyboard.SimulateKeyPress(keys.Enter)
time.Sleep(time.Millisecond * 500)
input = "33333333\n4\n5555555"
for _, r := range input {
if r == '\n' {
keyboard.SimulateKeyPress(keys.Enter)
} else {
keyboard.SimulateKeyPress(r)
}
time.Sleep(time.Millisecond * 250)
}
keyboard.SimulateKeyPress(keys.Tab)
}()
}
}