ruby-shell 0.11 → 0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -0
  3. data/bin/rsh +13 -2
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 002e79c6d55d5d7f9aedab8fd39f1e1712a00cc5346d5971017023bb98be6a36
4
- data.tar.gz: e55bcd60840eb1e244dfd74868a0efe28c9fa4d5eb85da778dd5642219a23647
3
+ metadata.gz: 74027c13c7db62ce3aa12c55a297c1f5de6c1f90e65cd321b08233b21503f728
4
+ data.tar.gz: 640c81426e0f51d6dad3ae95a19b78ce66f47422c2375dc828b19434d03a18a3
5
5
  SHA512:
6
- metadata.gz: d14305387565d0c2ec54843d4a3f256563e7079567c6f75b51a3357494582439f49648b43a0c60a7b509b5f01a52bcee23e293dbbbf47d82fbb8d58325173f58
7
- data.tar.gz: e5647e1c8b7218a50e76fab9cf1170ed5c5df863ad6530f66a571f083a881deaf3a94bad242d0543585f4c65bd38f7496466764c525d3ec8adfac25552997741
6
+ metadata.gz: 6aa949289f102093213e94cc4f984aa5bb5bde70979fe9ab2dee2b3aa9322b9c2123b1c3836f921c15d6917e4fcdd425b24648c18310a864878c01bc8c637218
7
+ data.tar.gz: 2f16565c9d92f4f281c4297f2177e0869449c02eed7f8eaa785295b5ed94bebecc0ed1339012b24f2d7bd45bcfd6e629db9d57e93f6581e4f88650697cb5d26f
data/README.md CHANGED
@@ -73,6 +73,9 @@ Variable | Description
73
73
  `@c_taboption` | Color for unselected tabcompleted item
74
74
  `@c_stamp` | Color for time stamp/command
75
75
 
76
+ # Open files
77
+ If you press `ENTER` after writing or tab-completing to a file, rsh will try to open the file in the user's EDITOR of choice (if it is a valid text file) or use `xdg-open` to open the file using the correct program. If you, for some reason want to use `run-mailcap` instead of `xdg-open` as the file opener, simply add `@runmailcap = true` to your `.rshrc`.
78
+
76
79
  # Enter the world of Ruby
77
80
  By entering `:some-ruby-command` you have full access to the Ruby universe right from your command line. You can do anything from `:puts 2 + 13` or `:if 0.7 > Math::sin(34) then puts "OK" end` or whatever tickles you fancy.
78
81
 
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.11"
17
+ @version = "0.12"
18
18
 
19
19
  # MODULES, CLASSES AND EXTENSIONS
20
20
  class String # Add coloring to strings (with escaping for Readline)
@@ -125,6 +125,8 @@ begin # Initialization
125
125
  # History
126
126
  @histsize = 100 # Max history if not set in .rshrc
127
127
  @hloaded = false # Variable to determine if history is loaded
128
+ # Use run-mailcap instead of xgd-open? Set = true in .rshrc if iyou want run-mailcap
129
+ @runmailcap = false
128
130
  # Variable initializations
129
131
  @cmd = "" # Initiate variable @cmd
130
132
  end
@@ -611,7 +613,16 @@ loop do
611
613
  res = `#{@cmd}`.chomp
612
614
  Dir.chdir(File.dirname(res))
613
615
  else
614
- if File.exist?(@cmd) then system("#{ENV['EDITOR']} #{@cmd}") # Try open with user's editor
616
+ if File.exist?(@cmd)
617
+ if File.read(@cmd).force_encoding("UTF-8").valid_encoding?
618
+ system("#{ENV['EDITOR']} #{@cmd}") # Try open with user's editor
619
+ else
620
+ if @runmailcap
621
+ Thread.new { system("run-mailcap #{@cmd} 2>/dev/null") }
622
+ else
623
+ Thread.new { system("xdg-open #{@cmd} 2>/dev/null") }
624
+ end
625
+ end
615
626
  elsif system(@cmd) # Try execute the command
616
627
  else puts "No such command: #{@cmd}"
617
628
  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.11'
4
+ version: '0.12'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
@@ -12,7 +12,7 @@ date: 2023-06-04 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.11: Added command :help to display the help text'
15
+ 0.12: Added xdg-open (or run-mailcap) to open files.'
16
16
  email: g@isene.com
17
17
  executables:
18
18
  - rsh