runcmd-cli 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53a9d5d2cdf2d1ebc8d0d507d71a11caf55421ce9fe5049f63ffd05d54573cf2
4
- data.tar.gz: 3fd535998a6d88eab5b864882955e65be5e1c3d74627da292dcc8d0b6b3e9b0c
3
+ metadata.gz: ad5b566183a923f930f79982088014564e6086219dca983644aea8d9e6a64be4
4
+ data.tar.gz: 7da8d489f917672176ca043e5953fac08579f7f7b8dfea178e3f997436914b8a
5
5
  SHA512:
6
- metadata.gz: cab64a40f5e8ce944678fcfa12e49d801470c88e29d7f683d11ebfb725460cf62ae557439ebd703e35fed17cd82926871a9ea03eb78ca9b3c407fe5e4cfc8e47
7
- data.tar.gz: 915d99415ae627b00fe8b831a2c1ce0f009e4a7438da9cfb9fd8b5016b18e0d215ce36e9e951baefa570289e0a5783d12c1cfaf7fb3c87ab1a119d8fd603a143
6
+ metadata.gz: a3dce50ad349dd8c0804bbfabbe59a8ec2e4aab48b3890302d75914c5ae5d5c664449a372081cf6a091a665ce6c44ef7d5876935150e80a17c67f1b8005b13b5
7
+ data.tar.gz: 2952ea3702d4795a3c8944bc9c78ef88eef19fee79e87dadc75ed8611caa263154230be3009e8fd8648b23cc4a76e9c70e82863bf7296c25cf8285861f0421a1
@@ -6,7 +6,7 @@ PATH
6
6
  PATH
7
7
  remote: .
8
8
  specs:
9
- runcmd-cli (0.2.1)
9
+ runcmd-cli (0.3.0)
10
10
  clamp
11
11
  runcmd
12
12
 
@@ -6,12 +6,13 @@ module Runcmd
6
6
  module Cli
7
7
  class PlayCommand < Clamp::Command
8
8
  parameter "RECORDING", "recording"
9
- option ["--speed", "-"], "SPEED", "speed", default: 0.1 do |s|
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 speed
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
- while c = $stdin.getch
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
@@ -1,5 +1,5 @@
1
1
  module Runcmd
2
2
  module Cli
3
- VERSION = "0.2.1"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runcmd-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matti Paksula