ruby-shell 0.6 → 0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -1
- data/bin/rsh +23 -18
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 947102ae716c38ff065cebc636d28aae8d41c558f498adc9b8a604c5bc3f63dc
|
4
|
+
data.tar.gz: f993423dc15b75bbace1628358f328b1a625f6b18d0afef80c2759b7f9b9a807
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69a90e0445b80e42ca6c3f15da9ee4ca641e6465d09b3342c96d4abfec5179427261a2b4bc68709afc15f12ba3aeaa40790460daeff5dbeb8e0c42587572db8c
|
7
|
+
data.tar.gz: f7a5bba35ab0f40056e102dd7613761da1f3ce9d34f7043fa2ec616390a3626fab64aba52d7e55433abead4d9d74e1584073ada150d7bc7fd37de154449ebc07
|
data/README.md
CHANGED
@@ -34,7 +34,13 @@ You can tab complete almost anything. Hitting `TAB` will try to complete in this
|
|
34
34
|
Hitting Shift-TAB will do a similar search through the command history - but with a general match of the search criteria (not only matching at the start).
|
35
35
|
|
36
36
|
## Integrations
|
37
|
-
rsh is integrated with the [rtfm file manager](https://github.com/isene/RTFM)
|
37
|
+
rsh is integrated with the [rtfm file manager](https://github.com/isene/RTFM), with [fzf](https://github.com/junegunn/fzf) and with the programming language [XRPN](https://github.com/isene/xrpn).
|
38
|
+
|
39
|
+
Just enter the command `r` and rtfm will be launched - and when you quit the file manager, you will drop back into rsh in the directory you where you exited rtfm.
|
40
|
+
|
41
|
+
Enter the command `fzf` to launch the fuzzy finder - select the directory/file you want, press `ENTER` and you will find yourself in the directory where that item resides.
|
42
|
+
|
43
|
+
If you start a line with "=", the rest of the line will be interpreted as an XRPN program. This gives you the full power of XRPN right at your fingertips. You can do simple stuff like this: `=13,23,*,x^2` and the answer to `(13 * 23)^2` will be given (89401) in the format that you have set in your `.xrpn/conf`. Or you can do more elaborate stuff like `=fix 6,5,sto c,time,'Time now is: ',atime,aview,pse,fix 0,lbl a,rcl c,prx,dse c,gto a`. Go crazy. Use single-quotes for any Alpha entry.
|
38
44
|
|
39
45
|
## Syntax highlighting
|
40
46
|
rsh will highlight nicks, gnicks, commands and dirs/files as they are written on the command line.
|
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.8"
|
18
18
|
|
19
19
|
# MODULES, CLASSES AND EXTENSIONS
|
20
20
|
class String # Add coloring to strings (with escaping for Readline)
|
@@ -423,7 +423,7 @@ def rshrc # Write updates to .rshrc
|
|
423
423
|
conf.sub!(/^@history.*\n/, "")
|
424
424
|
conf += "@history = #{@history.last(@histsize)}\n"
|
425
425
|
File.write(Dir.home+'/.rshrc', conf)
|
426
|
-
puts "
|
426
|
+
puts ".rshrc updated"
|
427
427
|
end
|
428
428
|
|
429
429
|
# RSH FUNCTIONS
|
@@ -480,23 +480,28 @@ end
|
|
480
480
|
|
481
481
|
# MAIN PART
|
482
482
|
loop do
|
483
|
-
@user = Etc.getpwuid(Process.euid).name # For use in @prompt
|
484
|
-
@node = Etc.uname[:nodename] # For use in @prompt
|
485
|
-
h = @history; load(Dir.home+'/.rshrc') if File.exist?(Dir.home+'/.rshrc'); @history = h # reload prompt but not history
|
486
|
-
@prompt.gsub!(/#{Dir.home}/, '~') # Simplify path in prompt
|
487
|
-
@cmd = getstr # Main work is here
|
488
|
-
hist_clean # Clean up the history
|
489
|
-
@cmd = "ls" if @cmd == "" # Default to ls when no command is given
|
490
|
-
print "\n"; @c.clear_screen_down
|
491
|
-
if @cmd == "r" # Integration with rtfm (https://github.com/isene/RTFM)
|
492
|
-
File.write("/tmp/.rshpwd", Dir.pwd)
|
493
|
-
system("rtfm /tmp/.rshpwd")
|
494
|
-
Dir.chdir(File.read("/tmp/.rshpwd"))
|
495
|
-
next
|
496
|
-
end
|
497
483
|
begin
|
484
|
+
@user = Etc.getpwuid(Process.euid).name # For use in @prompt
|
485
|
+
@node = Etc.uname[:nodename] # For use in @prompt
|
486
|
+
h = @history; load(Dir.home+'/.rshrc') if File.exist?(Dir.home+'/.rshrc'); @history = h # reload prompt but not history
|
487
|
+
@prompt.gsub!(/#{Dir.home}/, '~') # Simplify path in prompt
|
488
|
+
@cmd = getstr # Main work is here
|
489
|
+
hist_clean # Clean up the history
|
490
|
+
@cmd = "ls" if @cmd == "" # Default to ls when no command is given
|
491
|
+
print "\n"; @c.clear_screen_down
|
492
|
+
if @cmd == "r" # Integration with rtfm (https://github.com/isene/RTFM)
|
493
|
+
File.write("/tmp/.rshpwd", Dir.pwd)
|
494
|
+
system("rtfm /tmp/.rshpwd")
|
495
|
+
Dir.chdir(File.read("/tmp/.rshpwd"))
|
496
|
+
next
|
497
|
+
end
|
498
|
+
@cmd = "echo \"#{@cmd[1...]},prx,off\" | xrpn" if @cmd =~ /^\=/ # Integration with xrpn (https://github.com/isene/xrpn)
|
498
499
|
if @cmd.match(/^\s*:/) # Ruby commands are prefixed with ":"
|
499
|
-
|
500
|
+
begin
|
501
|
+
eval(@cmd[1..-1])
|
502
|
+
rescue Exception => err
|
503
|
+
puts "#{err}"
|
504
|
+
end
|
500
505
|
else # Execute command
|
501
506
|
@cmd.sub!(/^cd (\S*).*/, '\1')
|
502
507
|
@cmd = Dir.home if @cmd == "~"
|
@@ -509,7 +514,7 @@ loop do
|
|
509
514
|
ga = @gnick.transform_keys {|k| /\b#{Regexp.escape k}\b/}
|
510
515
|
@cmd = @cmd.gsub(Regexp.union(ga.keys), @gnick)
|
511
516
|
puts "#{Time.now.strftime("%H:%M:%S")}: #{@cmd}".c(@c_stamp)
|
512
|
-
if @cmd == "
|
517
|
+
if @cmd == "f" # fzf integration (https://github.com/junegunn/fzf)
|
513
518
|
res = `#{@cmd}`.chomp
|
514
519
|
Dir.chdir(File.dirname(res))
|
515
520
|
else
|
metadata
CHANGED
@@ -1,19 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-shell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.8'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geir Isene
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-01 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.
|
16
|
-
at #ruby at Libera.Chat).'
|
15
|
+
0.8: Better error handling.'
|
17
16
|
email: g@isene.com
|
18
17
|
executables:
|
19
18
|
- rsh
|