ruby-shell 0.14 → 0.16
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 +3 -0
- data/bin/rsh +32 -3
- 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: 0f69b050eaa1e06a29a3e744fe6a0810ceeb7ccc3fd4eb0ce988e1a28932ece4
|
|
4
|
+
data.tar.gz: 9edc0f0d12ad882cf8fb1e7a1316b1ef19ee49e8a2c44f445d23be95cf0a02fd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 39a5f34c1360543721e1b30a219cb8e3a31578a64a5e503f034dadc934a655f794360ee2eab065c73a937445c901c2b918695fc0ea478a8b1dffcf9633ce72f6
|
|
7
|
+
data.tar.gz: e3f29df7548b173a33e0ae882f651f8b8609de3a3228f366177866253b89c1483f9dfdfbeed59e2ae80168f4d6dd0eabb007ce26e35582a125afacb6dc91a3cc
|
data/README.md
CHANGED
|
@@ -39,6 +39,9 @@ Special commands:
|
|
|
39
39
|
* `:history` will list the command history, while `:rmhistory` will delete the history
|
|
40
40
|
* `:help` will display this help text
|
|
41
41
|
|
|
42
|
+
## Screencast
|
|
43
|
+
[](https://youtu.be/4P2z8oSo1u4)
|
|
44
|
+
|
|
42
45
|
## Moving around
|
|
43
46
|
While you `cd` around to different directories, you can see the last 10 directories visited via the command `:dirs` or the convenient shortcut `#`. Entering the number in the list (like `6` and ENTER) will jump you to that directory. Entering `-` will jump you back to the previous dir (equivalent of `1`. Entering `~` will get you to your home dir. If you want to bookmark a special directory, you can do that via a general nick like this: `:gnick "x = /path/to/a/dir/"` - this would bookmark the directory to the single letter `x`.
|
|
44
47
|
|
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.15"
|
|
18
18
|
|
|
19
19
|
# MODULES, CLASSES AND EXTENSIONS
|
|
20
20
|
class String # Add coloring to strings (with escaping for Readline)
|
|
@@ -246,9 +246,10 @@ def getstr # A custom Readline-like function
|
|
|
246
246
|
@stk = 0
|
|
247
247
|
@pos = 0
|
|
248
248
|
chr = ""
|
|
249
|
-
@history.
|
|
249
|
+
@history.unshift("")
|
|
250
250
|
while chr != "ENTER" # Keep going with readline until user presses ENTER
|
|
251
251
|
@ci = nil
|
|
252
|
+
lift = false
|
|
252
253
|
right = false
|
|
253
254
|
@c.clear_line
|
|
254
255
|
print @prompt
|
|
@@ -276,12 +277,23 @@ def getstr # A custom Readline-like function
|
|
|
276
277
|
@c.row(1)
|
|
277
278
|
@c.clear_screen_down
|
|
278
279
|
when 'UP' # Go up in history
|
|
280
|
+
if lift
|
|
281
|
+
@history.unshift("")
|
|
282
|
+
@history[0] = @history[@stk].dup
|
|
283
|
+
@stk += 1
|
|
284
|
+
end
|
|
279
285
|
unless @stk >= @history.length - 1
|
|
280
286
|
@stk += 1
|
|
281
287
|
@history[0] = @history[@stk].dup
|
|
282
288
|
@pos = @history[0].length
|
|
283
289
|
end
|
|
290
|
+
lift = false
|
|
284
291
|
when 'DOWN' # Go down in history
|
|
292
|
+
if lift
|
|
293
|
+
@history.unshift("")
|
|
294
|
+
@history[0] = @history[@stk].dup
|
|
295
|
+
@stk += 1
|
|
296
|
+
end
|
|
285
297
|
if @stk == 0
|
|
286
298
|
@history[0] = ""
|
|
287
299
|
@pos = 0
|
|
@@ -294,8 +306,14 @@ def getstr # A custom Readline-like function
|
|
|
294
306
|
@history[0] = @history[@stk].dup
|
|
295
307
|
@pos = @history[0].length
|
|
296
308
|
end
|
|
309
|
+
lift = false
|
|
297
310
|
when 'RIGHT' # Move right on the readline
|
|
298
311
|
if right
|
|
312
|
+
if lift
|
|
313
|
+
@history.unshift("")
|
|
314
|
+
@history[0] = @history[@stk].dup
|
|
315
|
+
@stk += 1
|
|
316
|
+
end
|
|
299
317
|
@history[0] = @history[@ci].dup
|
|
300
318
|
@pos = @history[0].length
|
|
301
319
|
end
|
|
@@ -308,11 +326,13 @@ def getstr # A custom Readline-like function
|
|
|
308
326
|
@pos = @history[0].length
|
|
309
327
|
when 'DEL' # Delete one character
|
|
310
328
|
@history[0][@pos] = ""
|
|
329
|
+
lift = true
|
|
311
330
|
when 'BACK' # Delete one character to the left
|
|
312
331
|
unless @pos <= 0
|
|
313
332
|
@pos -= 1
|
|
314
333
|
@history[0][@pos] = ""
|
|
315
334
|
end
|
|
335
|
+
lift = true
|
|
316
336
|
when 'WBACK' # Delete one word to the left (Ctrl-W)
|
|
317
337
|
unless @pos == @pos0
|
|
318
338
|
until @history[0][@pos - 1] == " " or @pos == 0
|
|
@@ -324,6 +344,7 @@ def getstr # A custom Readline-like function
|
|
|
324
344
|
@history[0][@pos] = ""
|
|
325
345
|
end
|
|
326
346
|
end
|
|
347
|
+
lift = true
|
|
327
348
|
when 'C-K' # Kill/delete that entry in the history
|
|
328
349
|
@history.delete_at(@stk)
|
|
329
350
|
@stk -= 1
|
|
@@ -332,13 +353,17 @@ def getstr # A custom Readline-like function
|
|
|
332
353
|
when 'LDEL' # Delete readline (Ctrl-U)
|
|
333
354
|
@history[0] = ""
|
|
334
355
|
@pos = 0
|
|
356
|
+
lift = true
|
|
335
357
|
when 'TAB' # Tab completion of dirs and files
|
|
336
358
|
@tabsearch =~ /^-/ ? tabbing("switch") : tabbing("all")
|
|
359
|
+
lift = true
|
|
337
360
|
when 'S-TAB'
|
|
338
361
|
tabbing("hist")
|
|
362
|
+
lift = true
|
|
339
363
|
when /^.$/
|
|
340
364
|
@history[0].insert(@pos,chr)
|
|
341
365
|
@pos += 1
|
|
366
|
+
lift = true
|
|
342
367
|
end
|
|
343
368
|
while STDIN.ready?
|
|
344
369
|
chr = STDIN.getc
|
|
@@ -492,6 +517,8 @@ def cmd_check(str) # Check if each element on the readline matches commands, nic
|
|
|
492
517
|
el.c(@c_path)
|
|
493
518
|
elsif system "which #{el}", %i[out err] => File::NULL
|
|
494
519
|
el.c(@c_cmd)
|
|
520
|
+
elsif el == "cd"
|
|
521
|
+
el.c(@c_cmd)
|
|
495
522
|
elsif el =~ /^-/
|
|
496
523
|
el.c(@c_switch)
|
|
497
524
|
else
|
|
@@ -585,6 +612,7 @@ loop do
|
|
|
585
612
|
@node = Etc.uname[:nodename] # For use in @prompt
|
|
586
613
|
h = @history; load(Dir.home+'/.rshrc') if File.exist?(Dir.home+'/.rshrc'); @history = h # reload prompt but not history
|
|
587
614
|
@prompt.gsub!(/#{Dir.home}/, '~') # Simplify path in prompt
|
|
615
|
+
system("printf \"\033]0;rsh: #{Dir.pwd}\007\"") # Set Window title to path
|
|
588
616
|
getstr # Main work is here
|
|
589
617
|
@cmd = @history[0]
|
|
590
618
|
@dirs.unshift(Dir.pwd)
|
|
@@ -618,6 +646,7 @@ loop do
|
|
|
618
646
|
@cmd = @cmd.gsub(Regexp.union(ca.keys), @nick)
|
|
619
647
|
ga = @gnick.transform_keys {|k| /\b#{Regexp.escape k}\b/}
|
|
620
648
|
@cmd = @cmd.gsub(Regexp.union(ga.keys), @gnick)
|
|
649
|
+
@cmd = "~" if @cmd == "cd"
|
|
621
650
|
@cmd.sub!(/^cd (\S*).*/, '\1')
|
|
622
651
|
@cmd = Dir.home if @cmd == "~"
|
|
623
652
|
@cmd = @dirs[1] if @cmd == "-"
|
|
@@ -629,7 +658,7 @@ loop do
|
|
|
629
658
|
else
|
|
630
659
|
puts "#{Time.now.strftime("%H:%M:%S")}: #{@cmd}".c(@c_stamp)
|
|
631
660
|
if @cmd == "f" # fzf integration (https://github.com/junegunn/fzf)
|
|
632
|
-
res =
|
|
661
|
+
res = `fzf`.chomp
|
|
633
662
|
Dir.chdir(File.dirname(res))
|
|
634
663
|
else
|
|
635
664
|
if File.exist?(@cmd)
|
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.16'
|
|
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-08 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
|
-
& #) - see Readme or Github for explanation'
|
|
15
|
+
0.16: Fixed several bugs, added screencast (https://youtu.be/4P2z8oSo1u4).'
|
|
17
16
|
email: g@isene.com
|
|
18
17
|
executables:
|
|
19
18
|
- rsh
|