ruby-shell 0.26 → 1.0.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 +4 -4
- data/bin/rsh +14 -7
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e671511dc4e419615c55552486a75258b34b7cdc422e6ce224334f83eaaccf7f
|
4
|
+
data.tar.gz: 48200a99d192e11175b626302d5cc35fcfd688567f35ee420fd452d74799c790
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de5c96b7a2163376ffb90954bb0ab8e5d42761d77357118f89614bd92e628d91121e38e6af6819fd13512d79c8e77478d73adec090cd362339582a2802a560fa
|
7
|
+
data.tar.gz: 5f506016a3c0ffd25c026e21111dbdfbde524f9260552f7d007aa8b0f648ea6f87c19701df2de3d07cd3f5f07b5dfe13420f2b2c292ccc24cad02a6105449646
|
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 = "1.0.1"
|
18
18
|
|
19
19
|
# MODULES, CLASSES AND EXTENSIONS
|
20
20
|
class String # Add coloring to strings (with escaping for Readline)
|
@@ -270,7 +270,7 @@ def getstr # A custom Readline-like function
|
|
270
270
|
case chr
|
271
271
|
when 'C-G', 'C-C'
|
272
272
|
@history[0] = ""
|
273
|
-
|
273
|
+
@pos = 0
|
274
274
|
when 'C-E' # Ctrl-C exits gracefully but without updating .rshrc
|
275
275
|
print "\n"
|
276
276
|
exit
|
@@ -281,6 +281,7 @@ def getstr # A custom Readline-like function
|
|
281
281
|
@c.row(1)
|
282
282
|
@c.clear_screen_down
|
283
283
|
when 'UP' # Go up in history
|
284
|
+
#@history[0] = @history[@history[(@stk+1)..].index{|h| h =~ /#{@history[0]}/}+1] #Future magick
|
284
285
|
if @stk == 0 and @history[0].length > 0
|
285
286
|
@tabsearch = @history[0]
|
286
287
|
tabbing("hist")
|
@@ -357,8 +358,13 @@ def getstr # A custom Readline-like function
|
|
357
358
|
when 'C-K' # Kill/delete that entry in the history
|
358
359
|
@history.delete_at(@stk)
|
359
360
|
@stk -= 1
|
360
|
-
@
|
361
|
-
|
361
|
+
if @stk == 0
|
362
|
+
@history[0] = ""
|
363
|
+
@pos = 0
|
364
|
+
else
|
365
|
+
@history[0] = @history[@stk].dup
|
366
|
+
@pos = @history[0].length
|
367
|
+
end
|
362
368
|
when 'LDEL' # Delete readline (Ctrl-U)
|
363
369
|
@history[0] = ""
|
364
370
|
@pos = 0
|
@@ -430,7 +436,7 @@ def tab_all(str) # TAB completion for Dirs/files, nicks and commands
|
|
430
436
|
end
|
431
437
|
def tab_switch(str) # TAB completion for command switches (TAB after "-")
|
432
438
|
begin
|
433
|
-
hlp = `#{str} --help`
|
439
|
+
hlp = `#{str} --help 2>/dev/null`
|
434
440
|
hlp = hlp.split("\n").grep(/^\s*-{1,2}[^-]/)
|
435
441
|
hlp = hlp.map{|h| h.sub(/^\s*/, '').sub(/^--/, ' --')}
|
436
442
|
switch = tabselect(hlp)
|
@@ -442,6 +448,7 @@ def tab_switch(str) # TAB completion for command switches (TAB after "-")
|
|
442
448
|
end
|
443
449
|
def tab_hist(str)
|
444
450
|
sel = @history.select {|el| el =~ /#{str}/}
|
451
|
+
sel.shift
|
445
452
|
sel.delete("")
|
446
453
|
hist = tabselect(sel, true)
|
447
454
|
if hist
|
@@ -462,7 +469,7 @@ def tabselect(ary, hist=false) # Let user select from the incoming array
|
|
462
469
|
tl = @tabsearch.length
|
463
470
|
if x == 0
|
464
471
|
@c.clear_line
|
465
|
-
tabchoice = ary[i].sub(
|
472
|
+
tabchoice = ary[i].sub(/^ *(.*?)[ ,].*/, '\1')
|
466
473
|
tabline = "#{@prompt}#{cmd_check(@tabstr)}#{tabchoice.c(@c_tabselect)}#{@tabend}"
|
467
474
|
print tabline # Full command line
|
468
475
|
@c_col = @pos0 + @tabstr.length + tabchoice.length
|
@@ -506,7 +513,7 @@ def tabselect(ary, hist=false) # Let user select from the incoming array
|
|
506
513
|
@c.clear_screen_down
|
507
514
|
@c.row(@c_row)
|
508
515
|
@c.col(@c_col)
|
509
|
-
return ary[i]
|
516
|
+
return ary[i].sub(/^ */, '')
|
510
517
|
end
|
511
518
|
def nextline # Handle going to the next line in the terminal
|
512
519
|
row, col = @c.pos
|
metadata
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-shell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.1
|
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-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 'A shell written in Ruby with extensive tab completions, aliases/nicks,
|
14
|
-
history, syntax highlighting, theming and more. In
|
15
|
-
0.
|
14
|
+
history, syntax highlighting, theming, auto-cd, auto-opening files and more. In
|
15
|
+
continual development. New in 1.0.1: Better history search vie the key UP.'
|
16
16
|
email: g@isene.com
|
17
17
|
executables:
|
18
18
|
- rsh
|