ruby-shell 0.10 → 0.11
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.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/bin/rsh +17 -12
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 002e79c6d55d5d7f9aedab8fd39f1e1712a00cc5346d5971017023bb98be6a36
|
4
|
+
data.tar.gz: e55bcd60840eb1e244dfd74868a0efe28c9fa4d5eb85da778dd5642219a23647
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d14305387565d0c2ec54843d4a3f256563e7079567c6f75b51a3357494582439f49648b43a0c60a7b509b5f01a52bcee23e293dbbbf47d82fbb8d58325173f58
|
7
|
+
data.tar.gz: e5647e1c8b7218a50e76fab9cf1170ed5c5df863ad6530f66a571f083a881deaf3a94bad242d0543585f4c65bd38f7496466764c525d3ec8adfac25552997741
|
data/README.md
CHANGED
@@ -37,6 +37,7 @@ Special commands:
|
|
37
37
|
* `:gnick 'h = /home/me'` to make a general alias (h) point to something (/home/me)
|
38
38
|
* `:nick?` will list all command nicks and general nicks (you can edit your nicks in .rshrc)
|
39
39
|
* `:history` will list the command history, while `:rmhistory` will delete the history
|
40
|
+
* `:help` will display this help text
|
40
41
|
|
41
42
|
## Nicks
|
42
43
|
Add command nicks (aliases) with `:nick "some_nick = some_command"`, e.g. `:nick "ls = ls --color"`. Add general nicks that will substitute anything on a command line (not just commands) like this `:gnick "some_gnick = some_command"`, e.g. `:gnick "x = /home/user/somewhere"`. List (g)nicks with `:nick?`. Remove a nick with `:nick "-some_command"`, e.g. `:nick "-ls"` to remove an `ls` nick. Same for gnicks.
|
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.11"
|
18
18
|
|
19
19
|
# MODULES, CLASSES AND EXTENSIONS
|
20
20
|
class String # Add coloring to strings (with escaping for Readline)
|
@@ -129,9 +129,9 @@ begin # Initialization
|
|
129
129
|
@cmd = "" # Initiate variable @cmd
|
130
130
|
end
|
131
131
|
|
132
|
-
#
|
133
|
-
|
134
|
-
|
132
|
+
# HELP TEXT
|
133
|
+
@help = <<~HELP
|
134
|
+
|
135
135
|
Hello #{@user}, welcome to rsh - the Ruby SHell.
|
136
136
|
|
137
137
|
rsh does not attempt to compete with the grand old shells like bash and zsh.
|
@@ -160,16 +160,19 @@ def firstrun
|
|
160
160
|
* `:gnick 'h = /home/me'` to make a general alias (h) point to something (/home/me)
|
161
161
|
* `:nick?` will list all command nicks and general nicks (you can edit your nicks in .rshrc)
|
162
162
|
* `:history` will list the command history, while `:rmhistory` will delete the history
|
163
|
+
* `:help` will display this help text
|
163
164
|
|
164
|
-
|
165
|
-
FIRSTRUN
|
165
|
+
HELP
|
166
166
|
|
167
|
-
|
168
|
-
|
167
|
+
# GENERIC FUNCTIONS
|
168
|
+
def firstrun
|
169
|
+
puts @help
|
170
|
+
puts "Since there is no rsh configuration file (.rshrc), I will help you set it up to suit your needs.\n\n"
|
171
|
+
puts "The prompt you see now is the very basic rsh prompt:"
|
169
172
|
print "#{@prompt} (press ENTER)"
|
170
173
|
STDIN.gets
|
171
|
-
puts "
|
172
|
-
puts "Feel free to amend the prompt in your .rshrc
|
174
|
+
puts "\nI will now change the prompt into something more useful."
|
175
|
+
puts "Feel free to amend the prompt in your .rshrc.\n\n"
|
173
176
|
rc = <<~RSHRC
|
174
177
|
# PROMPT
|
175
178
|
# The numbers in parenthesis are 256 color codes (the '.c()' is a String extention
|
@@ -190,7 +193,6 @@ FIRSTRUN
|
|
190
193
|
@nick = {"ls"=>"ls --color -F"}
|
191
194
|
RSHRC
|
192
195
|
File.write(Dir.home+'/.rshrc', rc)
|
193
|
-
|
194
196
|
end
|
195
197
|
def getchr # Process key presses
|
196
198
|
c = STDIN.getch
|
@@ -509,6 +511,9 @@ def rshrc # Write updates to .rshrc
|
|
509
511
|
end
|
510
512
|
|
511
513
|
# RSH FUNCTIONS
|
514
|
+
def help
|
515
|
+
puts @help
|
516
|
+
end
|
512
517
|
def history # Show history
|
513
518
|
puts "History:"
|
514
519
|
puts @history
|
@@ -594,7 +599,7 @@ loop do
|
|
594
599
|
@cmd.sub!(/^cd (\S*).*/, '\1')
|
595
600
|
@cmd = Dir.home if @cmd == "~"
|
596
601
|
dir = @cmd.strip.sub(/~/, Dir.home)
|
597
|
-
if Dir.
|
602
|
+
if Dir.exist?(dir)
|
598
603
|
Dir.chdir(dir)
|
599
604
|
else
|
600
605
|
ca = @nick.transform_keys {|k| /((^\K\s*\K)|(\|\K\s*\K))\b(?<!-)#{Regexp.escape k}\b/}
|
metadata
CHANGED
@@ -1,18 +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.11'
|
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-06-
|
11
|
+
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.11: Added command :help to display the help text'
|
16
16
|
email: g@isene.com
|
17
17
|
executables:
|
18
18
|
- rsh
|