console_cmdr 0.4.5 → 0.4.6
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +1 -2
- data/lib/console_cmdr.rb +33 -4
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5352718a2d75a75f6646a95dc3d7b5f10a0a515c
|
4
|
+
data.tar.gz: 4a5343df4abac9655aa44ee0fefee96376a096a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7aaa810b6646f7094b09c0706c8ab4495983afc378efb41cd3f5ebdcd3e763e10b414d9d4be863fbd2d4145e3c28f4eafb1e31d2b2a9692ce68d81c3d869a31b
|
7
|
+
data.tar.gz: a2ff90ad8620c58c110902c28a3d215db33d3bcfb191c5fc450ec5d582a5b92b3356e812a02e937a0f1ee8d5fecf9ac93eaa6825cf4cbbb57fe2b6c5ff3f884c
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
5g��c�r �?����Ry
|
1
|
+
[D8�Y�.���q�aS��G0�/��lb�d`� ��`�q�5V�i�9�~w����@c����(�ױJ��W�dd�@�넠��E��>]"3���w��O��R+��2 �KY@��2�}�n�Z<�����N�9hSFK)����p�) #ٲ�M���� Y�y���I��]�t���LL�51��x�)"vR��=�A�?[2G}�!tr�xZ\��)�����J4�O(��cj���#�^
|
data/lib/console_cmdr.rb
CHANGED
@@ -49,6 +49,7 @@ class ConsoleCmdr < Cmdr
|
|
49
49
|
|
50
50
|
c = $stdin.getch
|
51
51
|
#puts 'c:' + c.inspect
|
52
|
+
#puts
|
52
53
|
#puts c.ord
|
53
54
|
|
54
55
|
# [27, 91, 65] = up_arrow
|
@@ -68,7 +69,7 @@ class ConsoleCmdr < Cmdr
|
|
68
69
|
seq << 65
|
69
70
|
c = :arrow_up
|
70
71
|
on_keypress(c)
|
71
|
-
|
72
|
+
input c
|
72
73
|
elsif c.ord == 66 and seq[1] == 91
|
73
74
|
seq << 66
|
74
75
|
c = :arrow_down
|
@@ -113,6 +114,11 @@ class ConsoleCmdr < Cmdr
|
|
113
114
|
puts
|
114
115
|
@linebuffer = ''
|
115
116
|
display_output()
|
117
|
+
elsif c == "\u0012" # CTR+R
|
118
|
+
#repeat command
|
119
|
+
c = :ctrl_r
|
120
|
+
new_c = on_keypress(c)
|
121
|
+
input(new_c, &blk)
|
116
122
|
else
|
117
123
|
if block_given? then
|
118
124
|
char = on_keypress(c)
|
@@ -162,9 +168,21 @@ class ConsoleCmdr < Cmdr
|
|
162
168
|
print s + "\n> "
|
163
169
|
end
|
164
170
|
|
171
|
+
def clear_cli()
|
172
|
+
oldlinebuffer = @linebuffer
|
173
|
+
|
174
|
+
height, width = TermInfo.screen_size
|
175
|
+
|
176
|
+
print ("\b" * oldlinebuffer.length)
|
177
|
+
rblankpadding = ' ' * (width)
|
178
|
+
print rblankpadding
|
179
|
+
print ("\b" * rblankpadding.length)
|
180
|
+
end
|
181
|
+
|
165
182
|
def cli_update(s='')
|
183
|
+
|
166
184
|
print s
|
167
|
-
end
|
185
|
+
end
|
168
186
|
|
169
187
|
def on_keypress(key)
|
170
188
|
|
@@ -181,8 +199,12 @@ class ConsoleCmdr < Cmdr
|
|
181
199
|
end
|
182
200
|
|
183
201
|
query key if key
|
184
|
-
|
185
|
-
elsif key == :
|
202
|
+
|
203
|
+
elsif key == :arrow_up
|
204
|
+
# uses previous command in @history stack
|
205
|
+
elsif key == :arrow_down
|
206
|
+
# uses next command in @history stack
|
207
|
+
elsif key == :arrow_right
|
186
208
|
|
187
209
|
return if @input_selection.nil?
|
188
210
|
|
@@ -238,6 +260,13 @@ class ConsoleCmdr < Cmdr
|
|
238
260
|
end
|
239
261
|
|
240
262
|
select_item(i, append_command: true)
|
263
|
+
|
264
|
+
elsif key == :ctrl_r
|
265
|
+
|
266
|
+
@linebuffer = @history.last
|
267
|
+
cli_update @linebuffer
|
268
|
+
|
269
|
+
key = "\r"
|
241
270
|
end
|
242
271
|
|
243
272
|
return key
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: console_cmdr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
JRl6lG+PlMKYzPBmY9bJ9nnHUzlNaUigwV8HWjUzq9NmckAilhs430t3xe8+fsIc
|
32
32
|
uSZB48oWIrOfew==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2016-12-
|
34
|
+
date: 2016-12-13 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: cmdr
|
metadata.gz.sig
CHANGED
Binary file
|