ruby-shell 3.6.18 → 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.
- checksums.yaml +4 -4
- data/bin/rsh +28 -12
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c870824b26622fb9ac7d29cd504a40d8cd1078450c237d622f6e8de83b261067
|
|
4
|
+
data.tar.gz: 24cc04b6488f8b1aa9b2a9ea9e7435fb862a6471a0f985d1734ae0f24f26d943
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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.
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
|
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
|
|
@@ -562,9 +569,18 @@ def getstr # A custom Readline-like function
|
|
|
562
569
|
end
|
|
563
570
|
end
|
|
564
571
|
lift = true
|
|
565
|
-
when 'C-Y' # Copy
|
|
566
|
-
|
|
567
|
-
|
|
572
|
+
when 'C-Y' # Copy to clipboard
|
|
573
|
+
if @history[0].empty? && @history[1]
|
|
574
|
+
# Empty line: copy last command to clipboard
|
|
575
|
+
IO.popen('xclip -selection clipboard', 'w') { |io| io.write(@history[1]) } rescue nil
|
|
576
|
+
IO.popen('xclip -selection primary', 'w') { |io| io.write(@history[1]) } rescue nil
|
|
577
|
+
puts "\n#{Time.now.strftime("%H:%M:%S")}: Last command copied to clipboard".c(@c_stamp)
|
|
578
|
+
else
|
|
579
|
+
# Non-empty line: copy current line to clipboard
|
|
580
|
+
IO.popen('xclip -selection clipboard', 'w') { |io| io.write(@history[0]) } rescue nil
|
|
581
|
+
IO.popen('xclip -selection primary', 'w') { |io| io.write(@history[0]) } rescue nil
|
|
582
|
+
puts "\n#{Time.now.strftime("%H:%M:%S")}: Copied to clipboard".c(@c_stamp)
|
|
583
|
+
end
|
|
568
584
|
when 'C-Z' # Suspend current process (background job)
|
|
569
585
|
if @current_pid
|
|
570
586
|
puts "\n[#{@job_id}] Suspended #{@current_pid}"
|
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.
|
|
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-
|
|
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
|