runcmd-cli 0.4.0 → 0.4.1

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: 5318658dae58008c4e843001221635c1e581f5b73aaf67277eaaa38a9491fe39
4
- data.tar.gz: ea613226874bd09e8cb8b6820d0148fe2e5a14b0a2767e7dc8a88ab2a93932a1
3
+ metadata.gz: 0b4325e73e3658694f2d72821d74e1f672d9e5aafdc77ecce74a89c2e3d8bcf1
4
+ data.tar.gz: d5126d46406d0fee6158e8d5dc4567bb9994fa6c3d421e74807aab8273eeb615
5
5
  SHA512:
6
- metadata.gz: d6706aedcdbc9c1c6e5eaa7eb922620e7049fbdedb140365d8959d51b2c2b07afa1b67e8f2758c1cc3195f78bdc95150e71f36d3cad3626a5678d6acfdc497cd
7
- data.tar.gz: 0e3a1c81295e0c53b0553e38c31e90ecbb219c46c623c61cb773156ac15b590b1fbfb0b82fd5f643e785c7b0f089d3d91d77c00d2b01db412071f85b4d10b9c3
6
+ metadata.gz: d75b51f30faa0bdf1abe81d9905d3432a5fee714c50f0a0ea343b3e0b5d7535598e914e23a729d8604fa1bb2b6716ed5c5adefb304bc613447bd49626ede5342
7
+ data.tar.gz: d70b45679e117c383cccd6e0e32274a7d5c154a1b0bc9dd0b764777119349d9f973f4dac07b4a41c9eb8d7da706c11648c713ba75acb973e6387315c386c8894
data/.gitignore CHANGED
@@ -9,3 +9,5 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+
13
+ .runcmd
@@ -6,7 +6,7 @@ PATH
6
6
  PATH
7
7
  remote: .
8
8
  specs:
9
- runcmd-cli (0.4.0)
9
+ runcmd-cli (0.4.1)
10
10
  clamp
11
11
  runcmd
12
12
 
@@ -11,7 +11,18 @@ module Runcmd
11
11
  end
12
12
 
13
13
  def execute
14
- recording_input = File.new recording, "r"
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
- output_chars = []
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 "assert: "
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
- when "\u0003"
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
@@ -1,5 +1,5 @@
1
1
  module Runcmd
2
2
  module Cli
3
- VERSION = "0.4.0"
3
+ VERSION = "0.4.1"
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.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matti Paksula