ruby-shell 0.25 → 0.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/rsh +17 -13
  3. metadata +2 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 585443f4d2aa3921ec34a8267e09aab78a12e3f79cdcdb59da6ea8296abb76bf
4
- data.tar.gz: a401d6baf0b938900678e48d0a81dab507f116afa1c60017bfb4657f48a3c84e
3
+ metadata.gz: 748af44619d5fa3fe9949d80a0bbe6ee20b59f930d0aeb3a509fc87e75358b4c
4
+ data.tar.gz: abf4fdf08919b9703b839b9cf482b4d7c04f29018bf86c5656f162b04406760b
5
5
  SHA512:
6
- metadata.gz: 8e96de7caf23de35f75872a314b056d503576631fb758104fd11f349a18a9563f0b0073be4b346f92aaee24ccc716530ba9006410450ad80f763cefe488f1f3d
7
- data.tar.gz: b176b1a6f61a8f175de4f2509230f713c82d83be6758eb8cebf86847982cb7eb10bfc79a79c09103dc663f10ce599d03471e948098046fe3d0ad4759eda6a945
6
+ metadata.gz: 87ba4d133d7e1d9db8fe8725b51ba07f23fccb91d64f8f77acc6b48e9577da746edfbc296c4776c95311ef1b11bc50223576f0579072a3c12099749b968e5568
7
+ data.tar.gz: 9390042b865bf9bc03d4ff9c569ca797e68763632dd940713d0826051600943640d563932b08946e757f99476b82f8b9157c44e3d923c6b408d63551e5e27aef
data/bin/rsh CHANGED
@@ -14,7 +14,7 @@
14
14
  # for any damages resulting from its use. Further, I am under no
15
15
  # obligation to maintain or extend this software. It is provided
16
16
  # on an 'as is' basis without any expressed or implied warranty.
17
- @version = "0.25"
17
+ @version = "0.26"
18
18
 
19
19
  # MODULES, CLASSES AND EXTENSIONS
20
20
  class String # Add coloring to strings (with escaping for Readline)
@@ -525,6 +525,8 @@ def cmd_check(str) # Check if each element on the readline matches commands, nic
525
525
  str.gsub(/\S+/) do |el|
526
526
  if @nick.include?(el)
527
527
  el.c(@c_nick)
528
+ elsif el == "r"
529
+ el.c(@c_nick)
528
530
  elsif @gnick.include?(el)
529
531
  el.c(@c_gnick)
530
532
  elsif File.exist?(el.sub(/^~/, "/home/#{@user}"))
@@ -609,7 +611,7 @@ end
609
611
 
610
612
  # INITIAL SETUP
611
613
  begin # Load .rshrc and populate @history
612
- #trap "SIGINT" do print "\n"; exit end
614
+ trap "SIGINT" do end
613
615
  firstrun unless File.exist?(Dir.home+'/.rshrc') # Initial loading - to get history
614
616
  load(Dir.home+'/.rshrc')
615
617
  ENV["SHELL"] = __FILE__
@@ -691,19 +693,21 @@ loop do
691
693
  if @cmd == "f" # fzf integration (https://github.com/junegunn/fzf)
692
694
  res = `fzf`.chomp
693
695
  Dir.chdir(File.dirname(res))
694
- else
695
- if File.exist?(@cmd) and not File.executable?(@cmd)
696
- if File.read(@cmd).force_encoding("UTF-8").valid_encoding?
697
- system("#{ENV['EDITOR']} #{@cmd}") # Try open with user's editor
696
+ elsif File.exist?(@cmd) and not File.executable?(@cmd)
697
+ if File.read(@cmd).force_encoding("UTF-8").valid_encoding?
698
+ system("#{ENV['EDITOR']} #{@cmd}") # Try open with user's editor
699
+ else
700
+ if @runmailcap
701
+ Thread.new { system("run-mailcap #{@cmd} 2>/dev/null") }
698
702
  else
699
- if @runmailcap
700
- Thread.new { system("run-mailcap #{@cmd} 2>/dev/null") }
701
- else
702
- Thread.new { system("xdg-open #{@cmd} 2>/dev/null") }
703
- end
703
+ Thread.new { system("xdg-open #{@cmd} 2>/dev/null") }
704
704
  end
705
- elsif system(@cmd) # Try execute the command
706
- else puts "No such command or nick: #{@cmd}"
705
+ end
706
+ else
707
+ begin
708
+ puts "No such command or nick: #{@cmd}" unless system (@cmd) # Try execute the command
709
+ rescue StandardError => err
710
+ puts "\n#{err}"
707
711
  end
708
712
  end
709
713
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-shell
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.25'
4
+ version: '0.26'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
@@ -12,8 +12,7 @@ date: 2023-06-19 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 and more. In continual development. New in
15
- 0.25: Ctrl-C no longer exits rsh, it cancels the current input. Ctrl-e exits without
16
- config save.'
15
+ 0.26: Finally fixed a graceful handling of Ctrl-c.'
17
16
  email: g@isene.com
18
17
  executables:
19
18
  - rsh