ruby-shell 3.6.19 → 3.6.20

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 +16 -9
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6a7f4341f245a647d8c45ea36e67f17af871a3dd8dd67b0344257b152d7284ab
4
- data.tar.gz: 3a5ec017025daf61f39070689728ef14b787a47964084058be21279b2ef9f795
3
+ metadata.gz: c870824b26622fb9ac7d29cd504a40d8cd1078450c237d622f6e8de83b261067
4
+ data.tar.gz: 24cc04b6488f8b1aa9b2a9ea9e7435fb862a6471a0f985d1734ae0f24f26d943
5
5
  SHA512:
6
- metadata.gz: 1757bf42491dbde8d205d2756d8c3f41fba9dca3145e523d573ad40c6ffed4009ec35774f56da340936e8ddb71b7ebf53b6da366610a7564a296e08859a4a632
7
- data.tar.gz: 302631f9c4d365913bdb796179d8dcb2e67f45038230470d2ba3500e7d2f8606bee41543dfa35f4c87077150472327f7a9a156effc32435044809af9e15c4038
6
+ metadata.gz: d7666d9348df0d4d6fe53cc846fab95d9ad18ddabc06963acdef429a24c0e31371f2d97d757f788a07cf7b5e1fc73fd4dcb38438e6cdcc8af975dceaf504cc5b
7
+ data.tar.gz: 77573a08927e688ba0f71945ee0f4ec7f3ada7e0054733b2bf81213949b208e71327fcd953ed89c610b092ba926929f7873be91979ae9d0ebf8515f922578c50
data/bin/rsh CHANGED
@@ -8,22 +8,29 @@
8
8
  # Web_site: http://isene.com/
9
9
  # Github: https://github.com/isene/rsh
10
10
  # License: Public domain
11
- @version = "3.6.19" # Fix nick deletion and hyphenated command handling
11
+ @version = "3.6.20" # Performance: cache color escapes, pre-compile regex
12
12
 
13
13
  # MODULES, CLASSES AND EXTENSIONS
14
14
  class String # Add coloring to strings (with escaping for Readline)
15
- def c(code); color(self, "\001\e[38;5;#{code}m\002"); end # Color code
16
- def b; color(self, "\001\e[1m\002"); end # Bold
17
- def i; color(self, "\001\e[3m\002"); end # Italic
18
- def u; color(self, "\001\e[4m\002"); end # Underline
19
- def l; color(self, "\001\e[5m\002"); end # Blink
20
- def r; color(self, "\001\e[7m\002"); end # Reverse
21
- def color(text, color_code) "#{color_code}#{text}\001\e[0m\002" end
15
+ COLOR_CACHE = Hash.new { |h, k| h[k] = "\001\e[38;5;#{k}m\002".freeze }
16
+ RESET_CODE = "\001\e[0m\002".freeze
17
+ BOLD_CODE = "\001\e[1m\002".freeze
18
+ ITALIC_CODE = "\001\e[3m\002".freeze
19
+ ULINE_CODE = "\001\e[4m\002".freeze
20
+ BLINK_CODE = "\001\e[5m\002".freeze
21
+ REV_CODE = "\001\e[7m\002".freeze
22
+ def c(code); "#{COLOR_CACHE[code]}#{self}#{RESET_CODE}"; end # Color code
23
+ def b; "#{BOLD_CODE}#{self}#{RESET_CODE}"; end # Bold
24
+ def i; "#{ITALIC_CODE}#{self}#{RESET_CODE}"; end # Italic
25
+ def u; "#{ULINE_CODE}#{self}#{RESET_CODE}"; end # Underline
26
+ def l; "#{BLINK_CODE}#{self}#{RESET_CODE}"; end # Blink
27
+ def r; "#{REV_CODE}#{self}#{RESET_CODE}"; end # Reverse
22
28
  end
23
29
  module Cursor # Terminal cursor movement ANSI codes (thanks to https://github.com/piotrmurach/tty-cursor)
24
30
  module_function
25
31
  ESC = "\e".freeze
26
32
  CSI = "\e[".freeze
33
+ POS_RE = /(?<row>\d+);(?<col>\d+)/.freeze
27
34
  def save # Save current position
28
35
  print(Gem.win_platform? ? CSI + 's' : ESC + '7')
29
36
  end
@@ -44,7 +51,7 @@ module Cursor # Terminal cursor movement ANSI codes (thanks to https://github.co
44
51
  # Not a TTY, return default values
45
52
  return 25, 80
46
53
  end
47
- m = res.match /(?<row>\d+);(?<col>\d+)/
54
+ m = res.match POS_RE
48
55
  return m ? [m[:row].to_i, m[:col].to_i] : [25, 80]
49
56
  end
50
57
  def rowget
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-shell
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.19
4
+ version: 3.6.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-25 00:00:00.000000000 Z
11
+ date: 2026-03-28 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, auto-cd, auto-opening files and more. UPDATE