ruby-shell 2.10.0 → 2.10.1

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 +27 -15
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f20098ee7a4e00745916fb1830834273a00dbc5e92bea6b5f1cbd0f66b48639
4
- data.tar.gz: 135135d2f788b75eb9e51cebd3dd3d680c4f07717819bf6fc9232bf8b4a32943
3
+ metadata.gz: ee2ef357d1196f43811ad6974313bbdb057f61cf90219146936f70a2ec6f16bb
4
+ data.tar.gz: 85540ca12677d88d6b2fb6999f17ce871b7c5142f20a0fa14e03685f82f41853
5
5
  SHA512:
6
- metadata.gz: c3494e59f58963262f8142850dbda9a76c50e6367a681389cd921a8db1bc47d2e68a6490799696c8b8e3437234934070364194f3aa81568a1f8bfdcfc61d9c0d
7
- data.tar.gz: 8586e7cda13c597863e1d93cb978f0e5815b554a177b6977e41e0f2bc0f1d5a6017e0c04dbf32e45369a2a16180eface4bd67831f8be74b6dc7129f5664e63ed
6
+ metadata.gz: f7a35b051b9d768cb2065e6308eecc030f3b153a31881b31e25813a377de06ea98b5e76f55233dbc0ae1ec30920091ee62817352f43fc5645c3a3d69db746c78
7
+ data.tar.gz: f8aeb41fa3870b02d96b111126c1770fb74e235a01847947937461c1a697195e3fc6152eb5a45a147c1703278e12a1b8dc5c279e1c1e4b51d81fbeb0672ed27f
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 = "2.9.1" # Bug fix: Improved command coloring for local executables and after ENTER
11
+ @version = "2.10.1" # Bug fix: Improved && operator logic for proper conditional execution
12
12
 
13
13
  # MODULES, CLASSES AND EXTENSIONS
14
14
  class String # Add coloring to strings (with escaping for Readline)
@@ -865,27 +865,39 @@ end
865
865
  def execute_conditional(cmd_line)
866
866
  # Split on && and || while preserving the operators
867
867
  parts = cmd_line.split(/(\s*&&\s*|\s*\|\|\s*)/)
868
-
869
- result = true
868
+
869
+ result = nil # Start with nil to handle first command
870
870
  i = 0
871
+
871
872
  while i < parts.length
872
- command = parts[i].strip
873
- next if command.empty?
874
-
875
- if command == '&&'
876
- i += 1
877
- next unless result # Skip if previous command failed
878
- elsif command == '||'
879
- i += 1
880
- next if result # Skip if previous command succeeded
873
+ part = parts[i].strip
874
+ i += 1
875
+ next if part.empty?
876
+
877
+ if part == '&&'
878
+ # If previous command failed, skip the rest until we find || or end
879
+ unless result
880
+ while i < parts.length && parts[i].strip != '||'
881
+ i += 1
882
+ end
883
+ end
884
+ elsif part == '||'
885
+ # If previous command succeeded, skip the rest until we find && or end
886
+ if result
887
+ while i < parts.length && parts[i].strip != '&&'
888
+ i += 1
889
+ end
890
+ end
881
891
  else
882
892
  # Execute the command
883
- success = system(command)
893
+ success = system(part)
884
894
  result = success
885
- puts " Command failed: #{command} (exit #{$?.exitstatus})" unless success
895
+ @last_exit = $?.exitstatus
896
+ puts " Command failed: #{part} (exit #{@last_exit})" unless success
886
897
  end
887
- i += 1
888
898
  end
899
+
900
+ result
889
901
  end
890
902
  def expand_braces(str)
891
903
  # Simple brace expansion: {a,b,c} -> a b c
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: 2.10.0
4
+ version: 2.10.1
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-09-16 00:00:00.000000000 Z
11
+ date: 2025-09-22 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