ruby-shell 0.26 → 1.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/rsh +12 -7
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 748af44619d5fa3fe9949d80a0bbe6ee20b59f930d0aeb3a509fc87e75358b4c
4
- data.tar.gz: abf4fdf08919b9703b839b9cf482b4d7c04f29018bf86c5656f162b04406760b
3
+ metadata.gz: b401cd958da9d499c8f83e10c0668100c8a37fe2ceada25115643c508ba79153
4
+ data.tar.gz: 14c6c94195fb174413aa92aa9b96a00dd4b7160c0321a5f12906734dbbde96f3
5
5
  SHA512:
6
- metadata.gz: 87ba4d133d7e1d9db8fe8725b51ba07f23fccb91d64f8f77acc6b48e9577da746edfbc296c4776c95311ef1b11bc50223576f0579072a3c12099749b968e5568
7
- data.tar.gz: 9390042b865bf9bc03d4ff9c569ca797e68763632dd940713d0826051600943640d563932b08946e757f99476b82f8b9157c44e3d923c6b408d63551e5e27aef
6
+ metadata.gz: aa7dadcea2331c1d524be7a987e4e6f7ed0a38e3ad8dbef5f5c4152011bb7ea9314ba4f7b73dbfc45e8a18537413e291283bdfe52b68095aeb6c7572176d385d
7
+ data.tar.gz: 160864330f697225deb7c391491266c82b1289b220724ef974609f13095bc8192196779ea99326d49524875d0da53aa2ee14d8db81b9c0308834442b09792426
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.26"
17
+ @version = "1.0"
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
- return
273
+ @pos = 0
274
274
  when 'C-E' # Ctrl-C exits gracefully but without updating .rshrc
275
275
  print "\n"
276
276
  exit
@@ -357,8 +357,13 @@ def getstr # A custom Readline-like function
357
357
  when 'C-K' # Kill/delete that entry in the history
358
358
  @history.delete_at(@stk)
359
359
  @stk -= 1
360
- @history[0] = @history[@stk].dup
361
- @pos = @history[0].length
360
+ if @stk == 0
361
+ @history[0] = ""
362
+ @pos = 0
363
+ else
364
+ @history[0] = @history[@stk].dup
365
+ @pos = @history[0].length
366
+ end
362
367
  when 'LDEL' # Delete readline (Ctrl-U)
363
368
  @history[0] = ""
364
369
  @pos = 0
@@ -430,7 +435,7 @@ def tab_all(str) # TAB completion for Dirs/files, nicks and commands
430
435
  end
431
436
  def tab_switch(str) # TAB completion for command switches (TAB after "-")
432
437
  begin
433
- hlp = `#{str} --help`
438
+ hlp = `#{str} --help 2>/dev/null`
434
439
  hlp = hlp.split("\n").grep(/^\s*-{1,2}[^-]/)
435
440
  hlp = hlp.map{|h| h.sub(/^\s*/, '').sub(/^--/, ' --')}
436
441
  switch = tabselect(hlp)
@@ -462,7 +467,7 @@ def tabselect(ary, hist=false) # Let user select from the incoming array
462
467
  tl = @tabsearch.length
463
468
  if x == 0
464
469
  @c.clear_line
465
- tabchoice = ary[i].sub(/(.*?)[ ,].*/, '\1')
470
+ tabchoice = ary[i].sub(/^ *(.*?)[ ,].*/, '\1')
466
471
  tabline = "#{@prompt}#{cmd_check(@tabstr)}#{tabchoice.c(@c_tabselect)}#{@tabend}"
467
472
  print tabline # Full command line
468
473
  @c_col = @pos0 + @tabstr.length + tabchoice.length
@@ -506,7 +511,7 @@ def tabselect(ary, hist=false) # Let user select from the incoming array
506
511
  @c.clear_screen_down
507
512
  @c.row(@c_row)
508
513
  @c.col(@c_col)
509
- return ary[i]
514
+ return ary[i].sub(/^ */, '')
510
515
  end
511
516
  def nextline # Handle going to the next line in the terminal
512
517
  row, col = @c.pos
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-shell
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.26'
4
+ version: '1.0'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
@@ -11,8 +11,8 @@ cert_chain: []
11
11
  date: 2023-06-19 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 continual development. New in
15
- 0.26: Finally fixed a graceful handling of Ctrl-c.'
14
+ history, syntax highlighting, theming, auto-cd, auto-opening files and more. In
15
+ continual development. New in 1.0: Several fixes. Celebrating rsh as my sole shell.'
16
16
  email: g@isene.com
17
17
  executables:
18
18
  - rsh