ruby-shell 0.14 → 0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/rsh +28 -2
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cc8a3f3e80656d09aeb3dc8e1d4a803d0cdd4230d2e32036d0de7fb24746b19
|
4
|
+
data.tar.gz: b08319ac8b7c86c6ba235a45b03f84727e833477ea4aeb3f26a4422a19032632
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f9f896f49182e320519dce320605c8c9d1cdde7cbb072379062c148a8764f546673150bb8a7e18bf7fa8d841cffeb7f89966f9500b9c99cdc9b551778dfbba2
|
7
|
+
data.tar.gz: 89fde9f621cf09e57dae9a2ce5f1182755769dc2d0ee53a91cec797ee0e1954b107f97d4cf9a879f0df13d27574d6fe19821632bc78de08137ee8f0efbbb9d7b
|
data/bin/rsh
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
# for any damages resulting from its use. Further, I am under no
|
15
15
|
# obligation to maintain or extend this software. It is provided
|
16
16
|
# on an 'as is' basis without any expressed or implied warranty.
|
17
|
-
@version = "0.
|
17
|
+
@version = "0.15"
|
18
18
|
|
19
19
|
# MODULES, CLASSES AND EXTENSIONS
|
20
20
|
class String # Add coloring to strings (with escaping for Readline)
|
@@ -246,9 +246,10 @@ def getstr # A custom Readline-like function
|
|
246
246
|
@stk = 0
|
247
247
|
@pos = 0
|
248
248
|
chr = ""
|
249
|
-
@history.
|
249
|
+
@history.unshift("")
|
250
250
|
while chr != "ENTER" # Keep going with readline until user presses ENTER
|
251
251
|
@ci = nil
|
252
|
+
lift = false
|
252
253
|
right = false
|
253
254
|
@c.clear_line
|
254
255
|
print @prompt
|
@@ -276,12 +277,23 @@ def getstr # A custom Readline-like function
|
|
276
277
|
@c.row(1)
|
277
278
|
@c.clear_screen_down
|
278
279
|
when 'UP' # Go up in history
|
280
|
+
if lift
|
281
|
+
@history.unshift("")
|
282
|
+
@history[0] = @history[@stk].dup
|
283
|
+
@stk += 1
|
284
|
+
end
|
279
285
|
unless @stk >= @history.length - 1
|
280
286
|
@stk += 1
|
281
287
|
@history[0] = @history[@stk].dup
|
282
288
|
@pos = @history[0].length
|
283
289
|
end
|
290
|
+
lift = false
|
284
291
|
when 'DOWN' # Go down in history
|
292
|
+
if lift
|
293
|
+
@history.unshift("")
|
294
|
+
@history[0] = @history[@stk].dup
|
295
|
+
@stk += 1
|
296
|
+
end
|
285
297
|
if @stk == 0
|
286
298
|
@history[0] = ""
|
287
299
|
@pos = 0
|
@@ -294,8 +306,14 @@ def getstr # A custom Readline-like function
|
|
294
306
|
@history[0] = @history[@stk].dup
|
295
307
|
@pos = @history[0].length
|
296
308
|
end
|
309
|
+
lift = false
|
297
310
|
when 'RIGHT' # Move right on the readline
|
298
311
|
if right
|
312
|
+
if lift
|
313
|
+
@history.unshift("")
|
314
|
+
@history[0] = @history[@stk].dup
|
315
|
+
@stk += 1
|
316
|
+
end
|
299
317
|
@history[0] = @history[@ci].dup
|
300
318
|
@pos = @history[0].length
|
301
319
|
end
|
@@ -308,11 +326,13 @@ def getstr # A custom Readline-like function
|
|
308
326
|
@pos = @history[0].length
|
309
327
|
when 'DEL' # Delete one character
|
310
328
|
@history[0][@pos] = ""
|
329
|
+
lift = true
|
311
330
|
when 'BACK' # Delete one character to the left
|
312
331
|
unless @pos <= 0
|
313
332
|
@pos -= 1
|
314
333
|
@history[0][@pos] = ""
|
315
334
|
end
|
335
|
+
lift = true
|
316
336
|
when 'WBACK' # Delete one word to the left (Ctrl-W)
|
317
337
|
unless @pos == @pos0
|
318
338
|
until @history[0][@pos - 1] == " " or @pos == 0
|
@@ -324,6 +344,7 @@ def getstr # A custom Readline-like function
|
|
324
344
|
@history[0][@pos] = ""
|
325
345
|
end
|
326
346
|
end
|
347
|
+
lift = true
|
327
348
|
when 'C-K' # Kill/delete that entry in the history
|
328
349
|
@history.delete_at(@stk)
|
329
350
|
@stk -= 1
|
@@ -332,13 +353,17 @@ def getstr # A custom Readline-like function
|
|
332
353
|
when 'LDEL' # Delete readline (Ctrl-U)
|
333
354
|
@history[0] = ""
|
334
355
|
@pos = 0
|
356
|
+
lift = true
|
335
357
|
when 'TAB' # Tab completion of dirs and files
|
336
358
|
@tabsearch =~ /^-/ ? tabbing("switch") : tabbing("all")
|
359
|
+
lift = true
|
337
360
|
when 'S-TAB'
|
338
361
|
tabbing("hist")
|
362
|
+
lift = true
|
339
363
|
when /^.$/
|
340
364
|
@history[0].insert(@pos,chr)
|
341
365
|
@pos += 1
|
366
|
+
lift = true
|
342
367
|
end
|
343
368
|
while STDIN.ready?
|
344
369
|
chr = STDIN.getc
|
@@ -585,6 +610,7 @@ loop do
|
|
585
610
|
@node = Etc.uname[:nodename] # For use in @prompt
|
586
611
|
h = @history; load(Dir.home+'/.rshrc') if File.exist?(Dir.home+'/.rshrc'); @history = h # reload prompt but not history
|
587
612
|
@prompt.gsub!(/#{Dir.home}/, '~') # Simplify path in prompt
|
613
|
+
system("printf \"\033]0;rsh: #{Dir.pwd}\007\"") # Set Window title to path
|
588
614
|
getstr # Main work is here
|
589
615
|
@cmd = @history[0]
|
590
616
|
@dirs.unshift(Dir.pwd)
|
metadata
CHANGED
@@ -1,19 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-shell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.15'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geir Isene
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-06-
|
11
|
+
date: 2023-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 'A shell written in Ruby with extensive tab completions, aliases/nicks,
|
14
14
|
history, syntax highlighting, theming and more. In continual development. New in
|
15
|
-
0.
|
16
|
-
& #) - see Readme or Github for explanation'
|
15
|
+
0.15: Better stack handling for history.'
|
17
16
|
email: g@isene.com
|
18
17
|
executables:
|
19
18
|
- rsh
|