runcmd-cli 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/Gemfile.lock +1 -1
- data/lib/runcmd/cli/play_command.rb +27 -2
- data/lib/runcmd/cli/record_command.rb +11 -4
- data/lib/runcmd/cli/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b4325e73e3658694f2d72821d74e1f672d9e5aafdc77ecce74a89c2e3d8bcf1
|
4
|
+
data.tar.gz: d5126d46406d0fee6158e8d5dc4567bb9994fa6c3d421e74807aab8273eeb615
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d75b51f30faa0bdf1abe81d9905d3432a5fee714c50f0a0ea343b3e0b5d7535598e914e23a729d8604fa1bb2b6716ed5c5adefb304bc613447bd49626ede5342
|
7
|
+
data.tar.gz: d70b45679e117c383cccd6e0e32274a7d5c154a1b0bc9dd0b764777119349d9f973f4dac07b4a41c9eb8d7da706c11648c713ba75acb973e6387315c386c8894
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -11,7 +11,18 @@ module Runcmd
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def execute
|
14
|
-
|
14
|
+
recording_path = if recording.end_with? ".runcmd"
|
15
|
+
recording
|
16
|
+
else
|
17
|
+
"#{recording}.runcmd"
|
18
|
+
end
|
19
|
+
|
20
|
+
unless File.exist? recording_path
|
21
|
+
$stderr.puts "File #{recording_path} does not exist."
|
22
|
+
exit 1
|
23
|
+
end
|
24
|
+
|
25
|
+
recording_input = File.new recording_path, "r"
|
15
26
|
version = recording_input.readline
|
16
27
|
cmd = recording_input.readline
|
17
28
|
args = recording_input.readline.split(" ")
|
@@ -61,14 +72,28 @@ module Runcmd
|
|
61
72
|
end
|
62
73
|
|
63
74
|
assert_string = assert_chars.join("")
|
64
|
-
|
75
|
+
|
65
76
|
loop do
|
77
|
+
# print "\033[s" #save cursor
|
78
|
+
# print "\033[0;0f" #move to top left
|
79
|
+
# print "\033[K" #erase current line
|
80
|
+
# print "\e[36m" #cyan
|
81
|
+
# print "Run-CMD> waiting for: #{assert_string}"
|
82
|
+
# print "\e[0m" #reset
|
83
|
+
# print "\033[u" #restore cursor
|
84
|
+
|
66
85
|
if $output.join("").match? assert_string
|
67
86
|
$output = []
|
68
87
|
break
|
69
88
|
end
|
89
|
+
|
70
90
|
sleep 0.1
|
71
91
|
end
|
92
|
+
|
93
|
+
# print "\033[s" #save cursor
|
94
|
+
# print "\033[0;0f" #move to top left
|
95
|
+
# print "\033[K" #erase current line
|
96
|
+
# print "\033[u" #restore cursor
|
72
97
|
end
|
73
98
|
end
|
74
99
|
|
@@ -37,7 +37,13 @@ module Runcmd
|
|
37
37
|
|
38
38
|
case c
|
39
39
|
when "\u0010"
|
40
|
-
print "
|
40
|
+
print "\033[s" #save cursor
|
41
|
+
print "\033[0;0f" #move to top left
|
42
|
+
print "\033[K" #erase current line
|
43
|
+
print "\e[36m" #cyan
|
44
|
+
print "Run-CMD> wait_for: "
|
45
|
+
print "\e[0m" #reset
|
46
|
+
|
41
47
|
assert_string = []
|
42
48
|
loop do
|
43
49
|
assert_c = $stdin.getch
|
@@ -48,6 +54,9 @@ module Runcmd
|
|
48
54
|
assert_string.pop
|
49
55
|
$stdout.print "\b"
|
50
56
|
$stdout.print "\033[K"
|
57
|
+
when "\f"
|
58
|
+
stdin.write "\x1B\x1Bl" # send it forward
|
59
|
+
break
|
51
60
|
when "\r"
|
52
61
|
$stdout.print "\r"
|
53
62
|
$stdout.print "\033[K"
|
@@ -66,9 +75,7 @@ module Runcmd
|
|
66
75
|
recording_input.print assert_string.join("")
|
67
76
|
recording_input.print "\u0003"
|
68
77
|
|
69
|
-
|
70
|
-
# control+c
|
71
|
-
stdin.print c
|
78
|
+
print "\033[u" #restore cursor
|
72
79
|
else
|
73
80
|
recording_input.print 'c'
|
74
81
|
recording_input.print c
|
data/lib/runcmd/cli/version.rb
CHANGED