ruby-shell 0.16 → 0.17

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -7
  3. data/bin/rsh +12 -4
  4. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f69b050eaa1e06a29a3e744fe6a0810ceeb7ccc3fd4eb0ce988e1a28932ece4
4
- data.tar.gz: 9edc0f0d12ad882cf8fb1e7a1316b1ef19ee49e8a2c44f445d23be95cf0a02fd
3
+ metadata.gz: 6ea645b8bba423139ea6be4e7733105473c56e38d7a3906d45d4168b8acc2326
4
+ data.tar.gz: 5673ee1c0114d7f23526489c8110643190c49b1727b2558dd75d82bf41ad4442
5
5
  SHA512:
6
- metadata.gz: 39a5f34c1360543721e1b30a219cb8e3a31578a64a5e503f034dadc934a655f794360ee2eab065c73a937445c901c2b918695fc0ea478a8b1dffcf9633ce72f6
7
- data.tar.gz: e3f29df7548b173a33e0ae882f651f8b8609de3a3228f366177866253b89c1483f9dfdfbeed59e2ae80168f4d6dd0eabb007ce26e35582a125afacb6dc91a3cc
6
+ metadata.gz: 0ae62a4ab5e9723e317dd8b6146e849350fcd9083b0702a00ce2ea27ead76749c9fb41156931bc22386aa6c0fe06cf9d11ebd98c64f80852c331c1c3bccd39be
7
+ data.tar.gz: 5c053d2d1c193843c5b8112bc947541ae14169cb89a8a7b5153f1808394efea7a1eb223e2a28ff25352a6a39d6beccaa199a1eb054db71b11d791dc6e68a8fe1
data/README.md CHANGED
@@ -14,13 +14,16 @@ Clone this repo and drop `rsh` into your preferred bin directory. Drop `.rshrc`
14
14
 
15
15
  Or simply `gem install ruby-shell`.
16
16
 
17
+ # Screencast
18
+ [![rsh screencast](/img/rsh-screencast.png)](https://youtu.be/4P2z8oSo1u4)
19
+
17
20
  # Features
18
21
  * Aliases (called nicks in rsh) - both for commands and general nicks
19
22
  * Syntax highlighting, matching nicks, system commands and valid dirs/files
20
23
  * Tab completions for nicks, system commands, command switches and dirs/files
21
24
  * Tab completion presents matches in a list to pick from
22
25
  * When you start to write a command, rsh will suggest the first match in the history and present that in "toned down" letters - press the arrow right key to accept the suggestion.
23
- * History with editing, search
26
+ * History with editing, search and repeat a history command (with `!`)
24
27
  * Config file (.rshrc) updates on exit (with Ctrl-d) or not (with Ctrl-c)
25
28
  * Set of simple rsh specific commands like nick, nick?, history and rmhistory
26
29
  * rsh specific commands and full set of Ruby commands available via :<command>
@@ -37,11 +40,9 @@ Special commands:
37
40
  * `:gnick 'h = /home/me'` to make a general alias (h) point to something (/home/me)
38
41
  * `:nick?` will list all command nicks and general nicks (you can edit your nicks in .rshrc)
39
42
  * `:history` will list the command history, while `:rmhistory` will delete the history
43
+ * `:version` Shows the rsh version number and the last published gem file version
40
44
  * `:help` will display this help text
41
45
 
42
- ## Screencast
43
- [![rsh screencast](/img/rsh-screencast.png)](https://youtu.be/4P2z8oSo1u4)
44
-
45
46
  ## Moving around
46
47
  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`.
47
48
 
@@ -53,6 +54,12 @@ You can tab complete almost anything. Hitting `TAB` will try to complete in this
53
54
 
54
55
  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).
55
56
 
57
+ ## Open files
58
+ 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`.
59
+
60
+ ## History
61
+ Show the history with `:history`. Redo a history command with an exclamation mark and the number corresponding to the position in the history, like `!5` would do the 5th history command again.
62
+
56
63
  ## Integrations
57
64
  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).
58
65
 
@@ -79,9 +86,6 @@ Variable | Description
79
86
  `@c_taboption` | Color for unselected tabcompleted item
80
87
  `@c_stamp` | Color for time stamp/command
81
88
 
82
- # Open files
83
- 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`.
84
-
85
89
  # Enter the world of Ruby
86
90
  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.
87
91
 
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.15"
17
+ @version = "0.17"
18
18
 
19
19
  # MODULES, CLASSES AND EXTENSIONS
20
20
  class String # Add coloring to strings (with escaping for Readline)
@@ -146,7 +146,7 @@ end
146
146
  * Tab completion presents matches in a list to pick from
147
147
  * When you start to write a command, rsh will suggest the first match in the history and
148
148
  present that in "toned down" letters - press the arrow right key to accept the suggestion.
149
- * History with editing, search
149
+ * History with editing, search and repeat a history command (with `!`)
150
150
  * Config file (.rshrc) updates on exit (with Ctrl-d) or not (with Ctrl-c)
151
151
  * Set of simple rsh specific commands like nick, nick?, history and rmhistory
152
152
  * rsh specific commands and full set of Ruby commands available via :<command>
@@ -162,6 +162,7 @@ end
162
162
  * `:gnick 'h = /home/me'` to make a general alias (h) point to something (/home/me)
163
163
  * `:nick?` will list all command nicks and general nicks (you can edit your nicks in .rshrc)
164
164
  * `:history` will list the command history, while `:rmhistory` will delete the history
165
+ * `:version` Shows the rsh version number and the last published gem file version
165
166
  * `:help` will display this help text
166
167
 
167
168
  HELP
@@ -547,9 +548,12 @@ end
547
548
  def help
548
549
  puts @help
549
550
  end
551
+ def version
552
+ puts "rsh version = #{@version} (latest RubyGems version is #{Gem.latest_version_for("ruby-shell").version} - https://github.com/isene/rsh)"
553
+ end
550
554
  def history # Show history
551
555
  puts "History:"
552
- puts @history
556
+ @history.each_with_index {|h,i| puts i.to_s + "; " + h}
553
557
  end
554
558
  def rmhistory # Delete history
555
559
  @history = []
@@ -619,6 +623,10 @@ loop do
619
623
  @dirs.pop
620
624
  hist_clean # Clean up the history
621
625
  @cmd = "ls" if @cmd == "" # Default to ls when no command is given
626
+ if @cmd.match(/^!\d+/)
627
+ hi = @history[@cmd.sub(/^!(\d+)$/, '\1').to_i+1]
628
+ @cmd = hi if hi
629
+ end
622
630
  print "\n"; @c.clear_screen_down
623
631
  if @cmd == "r" # Integration with rtfm (https://github.com/isene/RTFM)
624
632
  t = Time.now
@@ -639,7 +647,7 @@ loop do
639
647
  rescue Exception => err
640
648
  puts "\n#{err}"
641
649
  end
642
- elsif @cmd == '#'
650
+ elsif @cmd == '#' # List previous directories
643
651
  dirs
644
652
  else # Execute command
645
653
  ca = @nick.transform_keys {|k| /((^\K\s*\K)|(\|\K\s*\K))\b(?<!-)#{Regexp.escape k}\b/}
metadata CHANGED
@@ -1,18 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-shell
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.16'
4
+ version: '0.17'
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-08 00:00:00.000000000 Z
11
+ date: 2023-06-09 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: Fixed several bugs, added screencast (https://youtu.be/4P2z8oSo1u4).'
15
+ 0.17: Added the ! convention to redo history commands (like !5 to redo the 5th command
16
+ in hisotry)'
16
17
  email: g@isene.com
17
18
  executables:
18
19
  - rsh