ruby-shell 0.11 → 0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/bin/rsh +17 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60559c89ac1578e5677855dba379bd293acb3279bb132a072b7218c58055fce0
|
4
|
+
data.tar.gz: 4bc782571e3e56fc19177a24c22c386d4ac764bcb12a8042f8fed3c9563822dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a41cfe97a651db1d15d3ea5f06552d2b353d50fb8effa918ce701c907c3735f04e2c049c2922a3e9764e2372d7eadb2225589ad590179575bde9c70c05efd8b
|
7
|
+
data.tar.gz: 60e7c66ff3c6db7cbc9e50f226de7469a95737a202d0373c13e7155f430142e38b9a175eec986788887b1cebb4a88991e45262a6c6e5f2f29e1d8c6e287d00dc
|
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.
|
17
|
+
@version = "0.13"
|
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
|
@@ -585,14 +587,15 @@ loop do
|
|
585
587
|
system("rtfm #{tf}")
|
586
588
|
Dir.chdir(File.read(tf))
|
587
589
|
File.delete(tf)
|
590
|
+
system("git status .") if Dir.exist?(".git")
|
588
591
|
next
|
589
592
|
end
|
590
593
|
@cmd = "echo \"#{@cmd[1...]},prx,off\" | xrpn" if @cmd =~ /^\=/ # Integration with xrpn (https://github.com/isene/xrpn)
|
591
594
|
if @cmd.match(/^\s*:/) # Ruby commands are prefixed with ":"
|
592
595
|
begin
|
593
596
|
eval(@cmd[1..-1])
|
594
|
-
rescue StandardError => err
|
595
|
-
|
597
|
+
#rescue StandardError => err
|
598
|
+
rescue Exception => err
|
596
599
|
puts "\n#{err}"
|
597
600
|
end
|
598
601
|
else # Execute command
|
@@ -601,6 +604,7 @@ loop do
|
|
601
604
|
dir = @cmd.strip.sub(/~/, Dir.home)
|
602
605
|
if Dir.exist?(dir)
|
603
606
|
Dir.chdir(dir)
|
607
|
+
system("git status .") if Dir.exist?(".git")
|
604
608
|
else
|
605
609
|
ca = @nick.transform_keys {|k| /((^\K\s*\K)|(\|\K\s*\K))\b(?<!-)#{Regexp.escape k}\b/}
|
606
610
|
@cmd = @cmd.gsub(Regexp.union(ca.keys), @nick)
|
@@ -611,7 +615,16 @@ loop do
|
|
611
615
|
res = `#{@cmd}`.chomp
|
612
616
|
Dir.chdir(File.dirname(res))
|
613
617
|
else
|
614
|
-
if File.exist?(@cmd)
|
618
|
+
if File.exist?(@cmd)
|
619
|
+
if File.read(@cmd).force_encoding("UTF-8").valid_encoding?
|
620
|
+
system("#{ENV['EDITOR']} #{@cmd}") # Try open with user's editor
|
621
|
+
else
|
622
|
+
if @runmailcap
|
623
|
+
Thread.new { system("run-mailcap #{@cmd} 2>/dev/null") }
|
624
|
+
else
|
625
|
+
Thread.new { system("xdg-open #{@cmd} 2>/dev/null") }
|
626
|
+
end
|
627
|
+
end
|
615
628
|
elsif system(@cmd) # Try execute the command
|
616
629
|
else puts "No such command: #{@cmd}"
|
617
630
|
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.
|
4
|
+
version: '0.13'
|
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.
|
15
|
+
0.13: Automatic git status when entering a git repo/dir.'
|
16
16
|
email: g@isene.com
|
17
17
|
executables:
|
18
18
|
- rsh
|