ruby-shell 3.6.2 → 3.6.4

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 +41 -15
  3. metadata +4 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c92bc4c204bd55840ed61d4e975367ff9b7e72ab4d389c806e4e9b1c829fb66
4
- data.tar.gz: dd487cd42a008d5e6e6d0d7d7cc65c72fb31c24d9fee5793044771b7b435e49c
3
+ metadata.gz: f43a85064c0c806f2f07c09dc7daa156e1442fead861059ffb3cc8bb3dd99957
4
+ data.tar.gz: 38f2c45e3f73ec24cefb921be1699ceea76f6e5cb244bc6085d74d4a6ec8e972
5
5
  SHA512:
6
- metadata.gz: fa175ed91f9fc777239c1f961a7974c81fb464683327e1abf58a3bedc8f7935563345f64e83353d5541f79c2cb50ebdae8738d79882b4fce5878ab7e5f3a1b4c
7
- data.tar.gz: b7d62dd7c8b5eab8e699b0d83014fa9dca8ba90007b83cb563f3253128f4413d29629bad7605f8b721e0275fdeda4a68eebff421bc5c0ff2f50b90bbca6bc288
6
+ metadata.gz: aae3dc4127a202b71b35ef264cc8a571d8fdcb10c57dc7681d2b01d160b99df39c2d597b334c8e06b8da9b027f2aa153ed00114c741947226a97b07f1178e718
7
+ data.tar.gz: 663d554e209193606c705be5ea0972d9ff058168017d66e169e93123624bee8daeb62b46b0e06a31f6642000703b44303c0a97c56e5e32be0f09ba34cc267b40
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.2" # TAB completion cursor fix: Unified positioning
11
+ @version = "3.6.3" # Polish: Config persistence, aligned display, smart completion space management
12
12
 
13
13
  # MODULES, CLASSES AND EXTENSIONS
14
14
  class String # Add coloring to strings (with escaping for Readline)
@@ -899,9 +899,17 @@ def tab(type)
899
899
  @tabarray = sort_by_learning(completion_context, @tabarray)
900
900
  end
901
901
 
902
- @c.clear_screen_down # Here we go
902
+ # Smart space calculation: Limit items to available screen space
903
+ current_row, current_col = @c.pos
904
+ space_available = @maxrow - current_row - 1 # Lines below cursor
903
905
  max_items = @completion_limit || 5
904
- @tabarray.length.to_i - i < max_items ? l = @tabarray.length.to_i - i : l = max_items
906
+
907
+ # Show what fits: min of (space, limit, remaining items)
908
+ items_can_show = [space_available, max_items, @tabarray.length.to_i - i].min
909
+ items_can_show = [items_can_show, 1].max # At least 1
910
+
911
+ @c.clear_screen_down # Here we go
912
+ l = items_can_show
905
913
  l.times do |x| # Iterate through
906
914
  if x == 0 # First item goes onto the commandline
907
915
  @c.clear_line # Clear the line
@@ -928,7 +936,7 @@ def tab(type)
928
936
  # Unified cursor positioning (always +1 since @pos0 is now string length)
929
937
  @c_col = @pos0 + @pos + 1
930
938
  @c.col(@c_col) # Set the cursor position
931
- nextline # Then start showing the completion items
939
+ nextline # Show items below
932
940
  tabline = @tabarray[i] # Get the next matching tabline
933
941
  # Add executable indicator
934
942
  display_item = tabline.dup
@@ -1197,17 +1205,29 @@ def config(*args) # Configure rsh settings
1197
1205
  value = args[1]
1198
1206
 
1199
1207
  if setting.nil?
1200
- # Show current configuration
1208
+ # Show current configuration with aligned columns
1201
1209
  puts "\n Current Configuration:".c(@c_prompt).b
1202
- puts " history_dedup: #{@history_dedup}"
1203
- puts " session_autosave: #{@session_autosave}s #{@session_autosave > 0 ? '(enabled)' : '(disabled)'}"
1204
- puts " auto_correct: #{@auto_correct ? 'on' : 'off'}"
1205
- puts " slow_command_threshold: #{@slow_command_threshold}s #{@slow_command_threshold > 0 ? '(enabled)' : '(disabled)'}"
1206
- puts " completion_learning: #{@completion_learning ? 'on' : 'off'}"
1207
- puts " show_tips: #{@show_tips ? 'on' : 'off'}"
1208
- puts " completion_limit: #{@completion_limit}"
1209
- puts " completion_fuzzy: #{@completion_fuzzy}"
1210
- puts " completion_case_sensitive: #{@completion_case_sensitive}"
1210
+ config_items = [
1211
+ ["history_dedup", @history_dedup],
1212
+ ["session_autosave", "#{@session_autosave}s", @session_autosave > 0 ? "(enabled)" : "(disabled)"],
1213
+ ["auto_correct", @auto_correct ? "on" : "off"],
1214
+ ["slow_command_threshold", "#{@slow_command_threshold}s", @slow_command_threshold > 0 ? "(enabled)" : "(disabled)"],
1215
+ ["completion_learning", @completion_learning ? "on" : "off"],
1216
+ ["show_tips", @show_tips ? "on" : "off"],
1217
+ ["completion_limit", @completion_limit],
1218
+ ["completion_fuzzy", @completion_fuzzy],
1219
+ ["completion_case_sensitive", @completion_case_sensitive]
1220
+ ]
1221
+
1222
+ # Find max label width for alignment
1223
+ max_label = config_items.map { |item| item[0].length }.max
1224
+
1225
+ config_items.each do |item|
1226
+ label = item[0].ljust(max_label)
1227
+ value = item[1].to_s.ljust(6) # Tighter spacing (10 → 6)
1228
+ extra = item[2] || ""
1229
+ puts " #{label} #{value} #{extra}"
1230
+ end
1211
1231
  puts
1212
1232
  return
1213
1233
  end
@@ -1492,6 +1512,7 @@ def rshrc # Write user configuration to .rshrc (portable between machines)
1492
1512
  conf = persist_var(conf, '@auto_correct', @auto_correct, @auto_correct)
1493
1513
  conf = persist_var(conf, '@slow_command_threshold', @slow_command_threshold, @slow_command_threshold && @slow_command_threshold > 0)
1494
1514
  conf = persist_var(conf, '@completion_learning', @completion_learning, !@completion_learning)
1515
+ conf = persist_var(conf, '@show_tips', @show_tips, !@show_tips)
1495
1516
  conf = persist_var(conf, '@completion_show_metadata', @completion_show_metadata, @completion_show_metadata)
1496
1517
  conf = persist_var(conf, '@plugin_disabled', @plugin_disabled, !@plugin_disabled.empty?)
1497
1518
  conf = persist_var(conf, '@validation_rules', @validation_rules, !@validation_rules.empty?)
@@ -3805,10 +3826,15 @@ loop do
3805
3826
  pre_cmd
3806
3827
 
3807
3828
  # Apply auto-correct if enabled (before validation)
3829
+ original_cmd = @cmd
3808
3830
  @cmd = apply_auto_correct(@cmd)
3809
3831
 
3810
3832
  # Print timestamp AFTER auto-correct (shows what actually executes)
3811
- puts "#{Time.now.strftime("%H:%M:%S")}: #{@cmd}".c(@c_stamp)
3833
+ if @cmd != original_cmd
3834
+ puts "#{Time.now.strftime("%H:%M:%S")}: #{@cmd} (autocorrected from \"#{original_cmd}\")".c(@c_stamp)
3835
+ else
3836
+ puts "#{Time.now.strftime("%H:%M:%S")}: #{@cmd}".c(@c_stamp)
3837
+ end
3812
3838
 
3813
3839
  # Validate command after auto-correction
3814
3840
  warnings = validate_command(@cmd)
metadata CHANGED
@@ -1,20 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-shell
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.2
4
+ version: 3.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-11-12 00:00:00.000000000 Z
11
+ date: 2025-11-15 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
15
- v3.6.0: MULTI-LINE PROMPT SUPPORT - Complete readline refactor with rcurses-inspired
16
- ANSI handling. Define prompts with newlines! Plus nick/history export, 9 new completions,
17
- validation templates, startup tips, and critical performance fixes for huge PATHs!'
15
+ v3.6.4: Autocorrect visibility - Shows when commands are autocorrected with clear
16
+ ''(autocorrected from "original")'' indicator.'
18
17
  email: g@isene.com
19
18
  executables:
20
19
  - rsh