ruby-shell 0.10 → 0.11

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 +1 -0
  3. data/bin/rsh +17 -12
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37f126a017a54cab294467b035635ce6992f4ae1d67befcd7d4a33882929be5a
4
- data.tar.gz: 7210fde457362b3a08e793e62ecf27059e244f514bd77f7aaf8f980c47974826
3
+ metadata.gz: 002e79c6d55d5d7f9aedab8fd39f1e1712a00cc5346d5971017023bb98be6a36
4
+ data.tar.gz: e55bcd60840eb1e244dfd74868a0efe28c9fa4d5eb85da778dd5642219a23647
5
5
  SHA512:
6
- metadata.gz: 5690e8bed0c4efbcf3194e8a2d5e1cdfa5e339c26cee90281818e6c7d35a4b0ce3c64dbe769b67fc86ff89220304598a15a8f56844c179376ca4813b2baafa71
7
- data.tar.gz: 4f0c21b28d1ae2f19cd28d7727e2dce0e8097479188b122092649b49080e60f9210f489155ec2e81b2d7551f3b226f7ee78229abe3814cfc3093140a0c757d38
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.10"
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
- # GENERIC FUNCTIONS
133
- def firstrun
134
- @firstrun = <<~FIRSTRUN
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
- Since there is no rsh configuration file (.rshrc), I will help you set it up to suit your needs.
165
- FIRSTRUN
165
+ HELP
166
166
 
167
- puts @firstrun
168
- puts "The prompt you see now is the very basic rsh prompt: "
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 "I will now change the prompt into something more useful."
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.exists?(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.10'
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-03 00:00:00.000000000 Z
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.10: Added introduction and creation of .rshrc on first run. Improved rtfm integration.'
15
+ 0.11: Added command :help to display the help text'
16
16
  email: g@isene.com
17
17
  executables:
18
18
  - rsh