ruby-shell 0.20 → 0.21

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 +1 -0
  3. data/bin/rsh +26 -16
  4. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b228176dfbc09b05c908d44bd1121aa7bd9c0c18c6cbf06c09a74bc9c4e492bb
4
- data.tar.gz: 8ff9a56792681fcc704ec6de601255a43c4b5e23a88b100f121d5e2c33c9aa7a
3
+ metadata.gz: a8d28ba94f7b6a6e05496bccb94efe444ba34871ab036b448fb0d074dcadf59d
4
+ data.tar.gz: 041e37fe2d4876a59b097d74eddd846be9de62915ee857943c4c86b2e4080a50
5
5
  SHA512:
6
- metadata.gz: 6c6b7100c0eda1aa62a1f74839d5c6bbaa80f99f788ed106f3f98c7b0e7ee8ee705dcfe69cb692ebd0f275e264324cec53bc2874e4e638b705c6b9a49277a6fc
7
- data.tar.gz: 9d01e0a80972585cef90ed9e90f865f13aebb03e04502084a4a9f65500430ca548e19b3a5eb8c9dbfd594bcefe836bb33aea110f7ace4e20b6253ca270621fff
6
+ metadata.gz: a681b059f27359fa185cc6f1092ac3bf2b8e9084a79ee5650f154b906b25ec84a20eb4920961576a945787cb6d925c6f16cab915383ea9b07ba3a2ed58bc634d
7
+ data.tar.gz: 04bde7676375ce81782b2ba15abda281a650de049d79734eb23b0db4b67987f089db1b2fd4bf3be52bc5dc6730f900d95acc2ade046fe70097272cf09730673e
data/README.md CHANGED
@@ -23,6 +23,7 @@ Or simply `gem install ruby-shell`.
23
23
  * Tab completions for nicks, system commands, command switches and dirs/files
24
24
  * Tab completion presents matches in a list to pick from
25
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.
26
+ * Writing a partial command and pressing `UP` will search history for matches. Go down/up in the list and press `TAB` or `ENTER` to accept or `Ctrl-G` to discard
26
27
  * History with editing, search and repeat a history command (with `!`)
27
28
  * Config file (.rshrc) updates on exit (with Ctrl-d) or not (with Ctrl-c)
28
29
  * Set of simple rsh specific commands like nick, nick?, history and rmhistory
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.20"
17
+ @version = "0.21"
18
18
 
19
19
  # MODULES, CLASSES AND EXTENSIONS
20
20
  class String # Add coloring to strings (with escaping for Readline)
@@ -145,8 +145,10 @@ end
145
145
  * Tab completions for nicks, system commands, command switches and dirs/files
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
- present that in "toned down" letters - press the arrow right key to accept the suggestion.
149
- * History with editing, search and repeat a history command (with `!`)
148
+ present that in "toned down" letters - press the arrow right key to accept the suggestion
149
+ * Writing a partial command and pressing `UP` will search history for matches.
150
+ Go down/up in the list and press `TAB` or `ENTER` to accept or `Ctrl-G` to discard
151
+ * History with editing, search and repeat a history command (with `!`)
150
152
  * Config file (.rshrc) updates on exit (with Ctrl-d) or not (with Ctrl-c)
151
153
  * Set of simple rsh specific commands like nick, nick?, history and rmhistory
152
154
  * rsh specific commands and full set of Ruby commands available via :<command>
@@ -278,17 +280,22 @@ def getstr # A custom Readline-like function
278
280
  @c.row(1)
279
281
  @c.clear_screen_down
280
282
  when 'UP' # Go up in history
281
- if lift
282
- @history.unshift("")
283
- @history[0] = @history[@stk].dup
284
- @stk += 1
285
- end
286
- unless @stk >= @history.length - 1
287
- @stk += 1
288
- @history[0] = @history[@stk].dup
289
- @pos = @history[0].length
283
+ if @stk == 0 and @history[0].length > 0
284
+ @tabsearch = @history[0]
285
+ tabbing("hist")
286
+ else
287
+ if lift
288
+ @history.unshift("")
289
+ @history[0] = @history[@stk].dup
290
+ @stk += 1
291
+ end
292
+ unless @stk >= @history.length - 1
293
+ @stk += 1
294
+ @history[0] = @history[@stk].dup
295
+ @pos = @history[0].length
296
+ end
297
+ lift = false
290
298
  end
291
- lift = false
292
299
  when 'DOWN' # Go down in history
293
300
  if lift
294
301
  @history.unshift("")
@@ -434,8 +441,11 @@ def tab_hist(str)
434
441
  sel = @history.select {|el| el =~ /#{str}/}
435
442
  sel.delete("")
436
443
  hist = tabselect(sel, true)
437
- @tabsearch = hist if hist
438
- @pos = @tabstr.length + @tabsearch.length if hist
444
+ if hist
445
+ @tabsearch = hist
446
+ @tabstr = ""
447
+ @pos = @tabsearch.length
448
+ end
439
449
  end
440
450
  def tabselect(ary, hist=false) # Let user select from the incoming array
441
451
  ary.uniq!
@@ -690,7 +700,7 @@ loop do
690
700
  end
691
701
  end
692
702
  elsif system(@cmd) # Try execute the command
693
- else puts "No such command: #{@cmd}"
703
+ else puts "No such command or nick: #{@cmd}"
694
704
  end
695
705
  end
696
706
  end
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.20'
4
+ version: '0.21'
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-12 00:00:00.000000000 Z
11
+ date: 2023-06-15 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.20: Changes needed to make rsh a proper login shell.'
15
+ 0.20: Better history search - write a partial command and press UP to get matches
16
+ in history.'
16
17
  email: g@isene.com
17
18
  executables:
18
19
  - rsh