ruby-shell 3.6.20 → 3.6.21

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 +42 -42
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c870824b26622fb9ac7d29cd504a40d8cd1078450c237d622f6e8de83b261067
4
- data.tar.gz: 24cc04b6488f8b1aa9b2a9ea9e7435fb862a6471a0f985d1734ae0f24f26d943
3
+ metadata.gz: 6b32638dfedc89a3a3cf6260e9859b9f1a84abac6031b74f63aebb4c0c88bb9a
4
+ data.tar.gz: b2784feda7cf2240ffa15c60cb09bc6399d4c421c54ce9d4551d0d9256845933
5
5
  SHA512:
6
- metadata.gz: d7666d9348df0d4d6fe53cc846fab95d9ad18ddabc06963acdef429a24c0e31371f2d97d757f788a07cf7b5e1fc73fd4dcb38438e6cdcc8af975dceaf504cc5b
7
- data.tar.gz: 77573a08927e688ba0f71945ee0f4ec7f3ada7e0054733b2bf81213949b208e71327fcd953ed89c610b092ba926929f7873be91979ae9d0ebf8515f922578c50
6
+ metadata.gz: 07eb2f410e2bd87dbdf053564595ff1aa204760b5d0d572b8ed80d50f6a79d4ffccec8119bf67b4c7236d169f49ab48c7c2edf36b07acd905f930344d19edf13
7
+ data.tar.gz: 72edff66208649aaf7460b5ac01ed71593135d075174351a5fbc52a91ad343f29b9c2af5632f5942c351382a87f01c45aa7d098b622df7794f295b5196d6770a
data/bin/rsh CHANGED
@@ -8,7 +8,7 @@
8
8
  # Web_site: http://isene.com/
9
9
  # Github: https://github.com/isene/rsh
10
10
  # License: Public domain
11
- @version = "3.6.20" # Performance: cache color escapes, pre-compile regex
11
+ @version = "3.6.21" # Rename String .b/.i/.u to .bd/.it/.ul for Ruby core compatibility
12
12
 
13
13
  # MODULES, CLASSES AND EXTENSIONS
14
14
  class String # Add coloring to strings (with escaping for Readline)
@@ -20,9 +20,9 @@ class String # Add coloring to strings (with escaping for Readline)
20
20
  BLINK_CODE = "\001\e[5m\002".freeze
21
21
  REV_CODE = "\001\e[7m\002".freeze
22
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
23
+ def bd; "#{BOLD_CODE}#{self}#{RESET_CODE}"; end # Bold
24
+ def it; "#{ITALIC_CODE}#{self}#{RESET_CODE}"; end # Italic
25
+ def ul; "#{ULINE_CODE}#{self}#{RESET_CODE}"; end # Underline
26
26
  def l; "#{BLINK_CODE}#{self}#{RESET_CODE}"; end # Blink
27
27
  def r; "#{REV_CODE}#{self}#{RESET_CODE}"; end # Reverse
28
28
  end
@@ -111,7 +111,7 @@ begin # Initialization
111
111
  @c_archive = 11 # Color for archives (yellow)
112
112
  @c_file = 7 # Color for regular files (white/default)
113
113
  # Prompt
114
- @prompt = "rsh > ".c(@c_prompt).b # Very basic prompt if not defined in .rshrc
114
+ @prompt = "rsh > ".c(@c_prompt).bd # Very basic prompt if not defined in .rshrc
115
115
  # Hash & array initializations
116
116
  @nick = {} # Initiate alias/nick hash
117
117
  @gnick = {} # Initiate generic/global alias/nick hash
@@ -250,7 +250,7 @@ def firstrun
250
250
  rc = <<~RSHRC
251
251
  # PROMPT
252
252
  # The numbers in parenthesis are 256 color codes (the '.c()' is a String extention
253
- # to color text in the terminal. Add '.b' for bold and '.i' for italics.
253
+ # to color text in the terminal. Add '.bd' for bold and '.it' for italics.
254
254
  @prompt = "\#{@user}@\#{@node}".c(46) + ":".c(255) + " \#{Dir.pwd}/".c(196) + " ".c(7)
255
255
 
256
256
  # THEME
@@ -954,7 +954,7 @@ def tab(type)
954
954
  choice_color = get_file_color(tabchoice)
955
955
  # Escape regex special characters in @tabstr for pattern matching
956
956
  escaped_tabstr = Regexp.escape(@tabstr)
957
- tabline = display_choice.sub(/(.*)#{escaped_tabstr}(.*)/, '\1'.c(choice_color) + @tabstr.u.c(choice_color) + '\2'.c(choice_color))
957
+ tabline = display_choice.sub(/(.*)#{escaped_tabstr}(.*)/, '\1'.c(choice_color) + @tabstr.ul.c(choice_color) + '\2'.c(choice_color))
958
958
  print prompt_for_tab + line1 + tabline + line2 # Print the commandline (use last line only for multi-line)
959
959
  @pos = @pretab.length.to_i + tabchoice.length.to_i # Set the position on that commandline
960
960
  # Unified cursor positioning (always +1 since @pos0 is now string length)
@@ -973,12 +973,12 @@ def tab(type)
973
973
  # Can't nest ANSI codes, they must each complete/conclude or they will mess eachother up
974
974
  escaped_tabstr = Regexp.escape(@tabstr)
975
975
  if display_item.include?(@tabstr)
976
- tabline1 = display_item.sub(/(.*?)#{escaped_tabstr}.*/, '\1').c(file_color).b # Bold + color for selected
977
- tabline2 = display_item.sub(/.*?#{escaped_tabstr}(.*)/, '\1').c(file_color).b
978
- print " " + tabline1 + @tabstr.c(file_color).u.b + tabline2 # Bold, color & underline @tabstr
976
+ tabline1 = display_item.sub(/(.*?)#{escaped_tabstr}.*/, '\1').c(file_color).bd # Bold + color for selected
977
+ tabline2 = display_item.sub(/.*?#{escaped_tabstr}(.*)/, '\1').c(file_color).bd
978
+ print " " + tabline1 + @tabstr.c(file_color).ul.bd + tabline2 # Bold, color & underline @tabstr
979
979
  else
980
980
  # For fuzzy matches, just show the whole word highlighted
981
- print " " + display_item.c(file_color).b
981
+ print " " + display_item.c(file_color).bd
982
982
  end
983
983
  # Add metadata if enabled
984
984
  if @completion_show_metadata && File.exist?(clean_item)
@@ -1011,7 +1011,7 @@ def tab(type)
1011
1011
  if display_item.include?(@tabstr)
1012
1012
  tabline1 = display_item.sub(/(.*?)#{escaped_tabstr}.*/, '\1').c(file_color) # Color before @tabstr
1013
1013
  tabline2 = display_item.sub(/.*?#{escaped_tabstr}(.*)/, '\1').c(file_color) # Color after @tabstr
1014
- print " " + tabline1 + @tabstr.c(file_color).u + tabline2 # Print the whole line
1014
+ print " " + tabline1 + @tabstr.c(file_color).ul + tabline2 # Print the whole line
1015
1015
  else
1016
1016
  # For fuzzy matches, just show the whole word
1017
1017
  print " " + display_item.c(file_color)
@@ -1232,7 +1232,7 @@ def config(*args) # Configure rsh settings
1232
1232
 
1233
1233
  if setting.nil?
1234
1234
  # Show current configuration with aligned columns
1235
- puts "\n Current Configuration:".c(@c_prompt).b
1235
+ puts "\n Current Configuration:".c(@c_prompt).bd
1236
1236
  config_items = [
1237
1237
  ["history_dedup", @history_dedup],
1238
1238
  ["session_autosave", "#{@session_autosave}s", @session_autosave > 0 ? "(enabled)" : "(disabled)"],
@@ -1313,7 +1313,7 @@ def env(*args) # Environment variable management
1313
1313
 
1314
1314
  if args.empty?
1315
1315
  # List all environment variables
1316
- puts "\n Environment Variables:".c(@c_prompt).b
1316
+ puts "\n Environment Variables:".c(@c_prompt).bd
1317
1317
  ENV.sort.first(20).each do |key, value|
1318
1318
  value_display = value.length > 50 ? value[0..47] + '...' : value
1319
1319
  puts " #{key.c(@c_gnick).ljust(25)} = #{value_display}"
@@ -1510,7 +1510,7 @@ def cmd_check(str) # Check if each element on the readline matches commands, nic
1510
1510
  elsif @gnick.include?(el)
1511
1511
  el.c(@c_gnick)
1512
1512
  elsif self.respond_to?(el) && singleton_class.instance_methods(false).include?(el.to_sym)
1513
- el.c(@c_nick).b # Ruby functions in bold nick color
1513
+ el.c(@c_nick).bd # Ruby functions in bold nick color
1514
1514
  elsif @bookmarks && @bookmarks.include?(el)
1515
1515
  # Color bookmarks (after commands and nicks)
1516
1516
  el.c(@c_bookmark)
@@ -1657,7 +1657,7 @@ def help
1657
1657
  col3 = []
1658
1658
 
1659
1659
  # Column 1: Keyboard + Commands + Jobs
1660
- col1 << "KEYBOARD:".c(@c_prompt).b
1660
+ col1 << "KEYBOARD:".c(@c_prompt).bd
1661
1661
  col1 << "Ctrl-G Edit in \$EDITOR"
1662
1662
  col1 << "Ctrl-Y Copy line"
1663
1663
  col1 << "Ctrl-D Exit + save"
@@ -1665,7 +1665,7 @@ def help
1665
1665
  col1 << "TAB Complete"
1666
1666
  col1 << "Shift-TAB History search"
1667
1667
  col1 << ""
1668
- col1 << "CORE COMMANDS:".c(@c_prompt).b
1668
+ col1 << "CORE COMMANDS:".c(@c_prompt).bd
1669
1669
  col1 << ":nick a = b Create alias"
1670
1670
  col1 << ":nick List all"
1671
1671
  col1 << ":nick -a Delete"
@@ -1679,26 +1679,26 @@ def help
1679
1679
  col1 << ":theme name Color schemes"
1680
1680
  col1 << ":plugins Extensions"
1681
1681
  col1 << ""
1682
- col1 << "JOBS:".c(@c_prompt).b
1682
+ col1 << "JOBS:".c(@c_prompt).bd
1683
1683
  col1 << "cmd & Background"
1684
1684
  col1 << ":jobs List jobs"
1685
1685
  col1 << ":fg [id] Foreground"
1686
1686
 
1687
1687
  # Column 2: Sessions + Bookmarks + Recording
1688
- col2 << "SESSIONS:".c(@c_prompt).b
1688
+ col2 << "SESSIONS:".c(@c_prompt).bd
1689
1689
  col2 << ":save_session nm Save state"
1690
1690
  col2 << ":load_session nm Load state"
1691
1691
  col2 << ":list_sessions Show all"
1692
1692
  col2 << ":rmsession nm|* Delete"
1693
1693
  col2 << ""
1694
- col2 << "BOOKMARKS:".c(@c_prompt).b
1694
+ col2 << "BOOKMARKS:".c(@c_prompt).bd
1695
1695
  col2 << ":bm nm path #tag Create"
1696
1696
  col2 << "name Jump to bookmark"
1697
1697
  col2 << ":bm List all"
1698
1698
  col2 << ":bm --stats Statistics"
1699
1699
  col2 << ":bm --export f Export"
1700
1700
  col2 << ""
1701
- col2 << "RECORDING:".c(@c_prompt).b
1701
+ col2 << "RECORDING:".c(@c_prompt).bd
1702
1702
  col2 << ":record start nm Start recording"
1703
1703
  col2 << ":record stop Stop recording"
1704
1704
  col2 << ":record show nm Show commands"
@@ -1706,7 +1706,7 @@ def help
1706
1706
  col2 << ":replay nm Execute"
1707
1707
  col2 << ":record List all"
1708
1708
  col2 << ""
1709
- col2 << "FEATURES:".c(@c_prompt).b
1709
+ col2 << "FEATURES:".c(@c_prompt).bd
1710
1710
  col2 << "gp branch=main Nick template"
1711
1711
  col2 << "!! Repeat last"
1712
1712
  col2 << "!-2 2nd to last"
@@ -1715,21 +1715,21 @@ def help
1715
1715
  col2 << ":completion_stats Learn patterns"
1716
1716
 
1717
1717
  # Column 3: Config + Integrations + Expansions
1718
- col3 << "CONFIG:".c(@c_prompt).b
1718
+ col3 << "CONFIG:".c(@c_prompt).bd
1719
1719
  col3 << ":config auto_correct on Auto-fix"
1720
1720
  col3 << ":config completion_learning on Learn TAB"
1721
1721
  col3 << ":config slow_command_threshold 5 Slow warn"
1722
1722
  col3 << ":config session_autosave 300 Auto-save"
1723
1723
  col3 << ":config history_dedup smart Dedup"
1724
1724
  col3 << ""
1725
- col3 << "INTEGRATIONS:".c(@c_prompt).b
1725
+ col3 << "INTEGRATIONS:".c(@c_prompt).bd
1726
1726
  col3 << "r rtfm file manager"
1727
1727
  col3 << "f fzf fuzzy finder"
1728
1728
  col3 << "= expr xrpn calculator"
1729
1729
  col3 << "@ text AI text response"
1730
1730
  col3 << "@@ cmd AI command suggest"
1731
1731
  col3 << ""
1732
- col3 << "EXPANSIONS:".c(@c_prompt).b
1732
+ col3 << "EXPANSIONS:".c(@c_prompt).bd
1733
1733
  col3 << "~ Home directory"
1734
1734
  col3 << "$VAR Environment var"
1735
1735
  col3 << "$(cmd) Command subst"
@@ -1737,7 +1737,7 @@ def help
1737
1737
  col3 << "cmd1 && cmd2 Conditional AND"
1738
1738
  col3 << "for i in... Bash scripts"
1739
1739
  col3 << ""
1740
- col3 << "MORE:".c(@c_prompt).b
1740
+ col3 << "MORE:".c(@c_prompt).bd
1741
1741
  col3 << ":help This help"
1742
1742
  col3 << ":info About rsh"
1743
1743
  col3 << ":version Version info"
@@ -1817,7 +1817,7 @@ end
1817
1817
  def nick(nick_str = nil) # Define a new nick like this: `:nick "ls = ls --color"`
1818
1818
  if nick_str.nil? || nick_str.empty?
1819
1819
  # List all nicks
1820
- puts "\n Command nicks:".c(@c_nick).b
1820
+ puts "\n Command nicks:".c(@c_nick).bd
1821
1821
  if @nick.empty?
1822
1822
  puts " (none defined)"
1823
1823
  else
@@ -1857,7 +1857,7 @@ end
1857
1857
  def gnick(nick_str = nil) # Define a generic/global nick to match not only commands (format like nick)
1858
1858
  if nick_str.nil? || nick_str.empty?
1859
1859
  # List all gnicks
1860
- puts "\n General nicks:".c(@c_gnick).b
1860
+ puts "\n General nicks:".c(@c_gnick).bd
1861
1861
  if @gnick.empty?
1862
1862
  puts " (none defined)"
1863
1863
  else
@@ -2026,7 +2026,7 @@ def stats(*args) # Show command execution statistics and analytics
2026
2026
  end
2027
2027
 
2028
2028
  # Display stats (existing code)
2029
- puts "\n Command Execution Statistics".c(@c_prompt).b
2029
+ puts "\n Command Execution Statistics".c(@c_prompt).bd
2030
2030
  puts " " + "="*50
2031
2031
 
2032
2032
  # Most used commands
@@ -2066,7 +2066,7 @@ def stats(*args) # Show command execution statistics and analytics
2066
2066
  puts
2067
2067
  end
2068
2068
  def stats_graph # Visual graph mode for stats
2069
- puts "\n Command Usage Graph".c(@c_prompt).b
2069
+ puts "\n Command Usage Graph".c(@c_prompt).bd
2070
2070
  puts " " + "="*50
2071
2071
 
2072
2072
  return puts "No data to display" if @cmd_frequency.nil? || @cmd_frequency.empty?
@@ -2094,7 +2094,7 @@ def stats_graph # Visual graph mode for stats
2094
2094
 
2095
2095
  # Performance graph if data exists
2096
2096
  if @cmd_stats && !@cmd_stats.empty?
2097
- puts "\n Command Performance Graph (avg time)".c(@c_prompt).b
2097
+ puts "\n Command Performance Graph (avg time)".c(@c_prompt).bd
2098
2098
  puts " " + "="*50
2099
2099
  puts
2100
2100
 
@@ -2173,7 +2173,7 @@ def bm(arg_str = nil) # Enhanced bookmark management with tags
2173
2173
  puts "No bookmarks defined. Use :bm \"name\" to bookmark current directory"
2174
2174
  return
2175
2175
  end
2176
- puts "\n Bookmarks:".c(@c_prompt).b
2176
+ puts "\n Bookmarks:".c(@c_prompt).bd
2177
2177
  @bookmarks.each do |name, data|
2178
2178
  path = data.is_a?(Hash) ? data[:path] : data
2179
2179
  tags = data.is_a?(Hash) && data[:tags] ? " [#{data[:tags].join(', ')}]" : ""
@@ -2284,7 +2284,7 @@ def bookmark_stats # Show bookmark usage statistics
2284
2284
  return
2285
2285
  end
2286
2286
 
2287
- puts "\n Bookmark Statistics".c(@c_prompt).b
2287
+ puts "\n Bookmark Statistics".c(@c_prompt).bd
2288
2288
  puts " " + "="*50
2289
2289
  puts "\n Total bookmarks: #{@bookmarks.length}"
2290
2290
 
@@ -2389,7 +2389,7 @@ def list_sessions # List all saved sessions
2389
2389
  return
2390
2390
  end
2391
2391
 
2392
- puts "\n Saved Sessions:".c(@c_prompt).b
2392
+ puts "\n Saved Sessions:".c(@c_prompt).bd
2393
2393
  sessions.sort.each do |name|
2394
2394
  session_path = @session_dir + "/#{name}.json"
2395
2395
  begin
@@ -2444,7 +2444,7 @@ def theme(*args) # Apply color scheme presets
2444
2444
  name = args[0]
2445
2445
 
2446
2446
  if name.nil?
2447
- puts "\n Available themes:".c(@c_prompt).b
2447
+ puts "\n Available themes:".c(@c_prompt).bd
2448
2448
  puts " default, solarized, dracula, gruvbox, nord, monokai"
2449
2449
  puts "\n Current theme colors:"
2450
2450
  puts " prompt:#{' '*5}#{@c_prompt} cmd:#{' '*8}#{@c_cmd} nick:#{' '*7}#{@c_nick}"
@@ -2576,7 +2576,7 @@ def plugins(*args) # Plugin management command
2576
2576
  return
2577
2577
  end
2578
2578
 
2579
- puts "\n Available Plugins:".c(@c_prompt).b
2579
+ puts "\n Available Plugins:".c(@c_prompt).bd
2580
2580
  available_plugins.each do |name|
2581
2581
  if @plugin_enabled.include?(name)
2582
2582
  status = '[enabled]'.c(@c_path)
@@ -2615,7 +2615,7 @@ def plugins(*args) # Plugin management command
2615
2615
  plugin_name = args[1]
2616
2616
  plugin = @plugins.find { |p| p[:name] == plugin_name }
2617
2617
  if plugin
2618
- puts "\n Plugin: #{plugin_name}".c(@c_prompt).b
2618
+ puts "\n Plugin: #{plugin_name}".c(@c_prompt).bd
2619
2619
  puts " Class: #{plugin[:class]}"
2620
2620
  puts " File: #{@plugin_dir}/#{plugin_name}.rb"
2621
2621
 
@@ -2785,13 +2785,13 @@ def validate(rule_str = nil) # Custom validation rule management
2785
2785
  puts "Or try: :validate --templates"
2786
2786
  return
2787
2787
  end
2788
- puts "\n Validation Rules:".c(@c_prompt).b
2788
+ puts "\n Validation Rules:".c(@c_prompt).bd
2789
2789
  @validation_rules.each_with_index do |rule, i|
2790
2790
  puts " #{i+1}. #{rule[:pattern].inspect} → #{rule[:action]}"
2791
2791
  end
2792
2792
  puts
2793
2793
  elsif rule_str == '--templates'
2794
- puts "\n Common Validation Rule Templates:".c(@c_prompt).b
2794
+ puts "\n Common Validation Rule Templates:".c(@c_prompt).bd
2795
2795
  puts " Safety:"
2796
2796
  puts " :validate rm -rf / = block"
2797
2797
  puts " :validate DROP TABLE = block"
@@ -2883,7 +2883,7 @@ def completion_stats # Show completion learning statistics
2883
2883
  return
2884
2884
  end
2885
2885
 
2886
- puts "\n Completion Learning Statistics".c(@c_prompt).b
2886
+ puts "\n Completion Learning Statistics".c(@c_prompt).bd
2887
2887
  puts " " + "="*50
2888
2888
 
2889
2889
  # Group by context
@@ -2922,7 +2922,7 @@ def record(*args) # Command recording management
2922
2922
  return
2923
2923
  end
2924
2924
 
2925
- puts "\n Recordings:".c(@c_prompt).b
2925
+ puts "\n Recordings:".c(@c_prompt).bd
2926
2926
  @recordings.each do |rec_name, data|
2927
2927
  created = Time.at(data[:created] || Time.now.to_i).strftime("%Y-%m-%d %H:%M")
2928
2928
  count = data[:commands]&.length || 0
@@ -2969,7 +2969,7 @@ def record(*args) # Command recording management
2969
2969
  recording = @recordings[name]
2970
2970
  created = Time.at(recording[:created] || Time.now.to_i).strftime("%Y-%m-%d %H:%M:%S")
2971
2971
 
2972
- puts "\n Recording: #{name}".c(@c_prompt).b
2972
+ puts "\n Recording: #{name}".c(@c_prompt).bd
2973
2973
  puts " Created: #{created}"
2974
2974
  puts " Commands: #{recording[:commands].length}"
2975
2975
  puts
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.20
4
+ version: 3.6.21
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-28 00:00:00.000000000 Z
11
+ date: 2026-04-11 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