runcmd-cli 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/runcmd/cli/play_command.rb +11 -2
- data/lib/runcmd/cli/record_command.rb +6 -1
- 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: ad5b566183a923f930f79982088014564e6086219dca983644aea8d9e6a64be4
|
4
|
+
data.tar.gz: 7da8d489f917672176ca043e5953fac08579f7f7b8dfea178e3f997436914b8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3dce50ad349dd8c0804bbfabbe59a8ec2e4aab48b3890302d75914c5ae5d5c664449a372081cf6a091a665ce6c44ef7d5876935150e80a17c67f1b8005b13b5
|
7
|
+
data.tar.gz: 2952ea3702d4795a3c8944bc9c78ef88eef19fee79e87dadc75ed8611caa263154230be3009e8fd8648b23cc4a76e9c70e82863bf7296c25cf8285861f0421a1
|
data/Gemfile.lock
CHANGED
@@ -6,12 +6,13 @@ module Runcmd
|
|
6
6
|
module Cli
|
7
7
|
class PlayCommand < Clamp::Command
|
8
8
|
parameter "RECORDING", "recording"
|
9
|
-
option ["--
|
9
|
+
option ["--delay"], "DELAY", "extra delay", default: 0.0 do |s|
|
10
10
|
Float(s)
|
11
11
|
end
|
12
12
|
|
13
13
|
def execute
|
14
14
|
recording_input = File.new recording, "r"
|
15
|
+
version = recording_input.readline
|
15
16
|
cmd = recording_input.readline
|
16
17
|
args = recording_input.readline.split(" ")
|
17
18
|
|
@@ -25,8 +26,16 @@ module Runcmd
|
|
25
26
|
stdout,stdin,pid = PTY.spawn(env, cmd, *args, err: stderr_writer.fileno)
|
26
27
|
stderr_writer.close
|
27
28
|
|
29
|
+
started_at = Time.now
|
28
30
|
stdin_thr = Thread.new do
|
29
31
|
while c = recording_input.getc
|
32
|
+
time = []
|
33
|
+
loop do
|
34
|
+
t = recording_input.getc
|
35
|
+
break if t == ":"
|
36
|
+
time << t
|
37
|
+
end
|
38
|
+
sleep time.join("").to_f
|
30
39
|
case c
|
31
40
|
when "\u0003"
|
32
41
|
# control+c
|
@@ -34,7 +43,7 @@ module Runcmd
|
|
34
43
|
else
|
35
44
|
stdin.print c
|
36
45
|
end
|
37
|
-
sleep
|
46
|
+
sleep delay
|
38
47
|
end
|
39
48
|
|
40
49
|
stdin.close
|
@@ -22,6 +22,7 @@ module Runcmd
|
|
22
22
|
|
23
23
|
recording_video = File.new "#{recording}.video", "w" if video
|
24
24
|
recording_input = File.new "#{recording}.runcmd", "w"
|
25
|
+
recording_input.puts Runcmd::Cli::VERSION
|
25
26
|
recording_input.puts cmd
|
26
27
|
recording_input.puts args.join(" ")
|
27
28
|
|
@@ -29,8 +30,12 @@ module Runcmd
|
|
29
30
|
stderr_writer.close
|
30
31
|
|
31
32
|
stdin_thr = Thread.new do
|
32
|
-
|
33
|
+
loop do
|
34
|
+
started_at = Time.now
|
35
|
+
c = $stdin.getch
|
33
36
|
recording_input.print c
|
37
|
+
recording_input.print (Time.now-started_at).floor(2)
|
38
|
+
recording_input.print ':'
|
34
39
|
case c
|
35
40
|
when "\u0003"
|
36
41
|
# control+c
|
data/lib/runcmd/cli/version.rb
CHANGED