ruby-shell 0.17 → 0.19

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 +10 -0
  3. data/bin/rsh +11 -4
  4. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6ea645b8bba423139ea6be4e7733105473c56e38d7a3906d45d4168b8acc2326
4
- data.tar.gz: 5673ee1c0114d7f23526489c8110643190c49b1727b2558dd75d82bf41ad4442
3
+ metadata.gz: e8c4db771e1dbd372496d80bf721a96c79e39ad21406e0cc2f68e3b382dd7df4
4
+ data.tar.gz: 7b7c8335bec3b659f7cc82f3f655dd179e053f74a016eed112969a2008cd0ced
5
5
  SHA512:
6
- metadata.gz: 0ae62a4ab5e9723e317dd8b6146e849350fcd9083b0702a00ce2ea27ead76749c9fb41156931bc22386aa6c0fe06cf9d11ebd98c64f80852c331c1c3bccd39be
7
- data.tar.gz: 5c053d2d1c193843c5b8112bc947541ae14169cb89a8a7b5153f1808394efea7a1eb223e2a28ff25352a6a39d6beccaa199a1eb054db71b11d791dc6e68a8fe1
6
+ metadata.gz: 0cfa55a0c59bfa616c725cee507632b85a2676a35cfc14f753bd673124d25bb74848a43ea6ac0cbdc09a8cf2c580f74ff93d0bb50602cfd8e760086365ec1705
7
+ data.tar.gz: 70f3584e3bfffe1b09f0bb3cc6bdf0b2aaa5028371d5b11ffae951bb2fd461babf4c989f682e22ccafea24fd9a1957ceaa7f6338b9443fa7baf44c6de46880f2
data/README.md CHANGED
@@ -86,6 +86,16 @@ Variable | Description
86
86
  `@c_taboption` | Color for unselected tabcompleted item
87
87
  `@c_stamp` | Color for time stamp/command
88
88
 
89
+ ## The .rshrc
90
+ `.rshrc` is the configuration file for rsh and it is located in your home directory. It is created when you first start rsh and you can modify it to suit your needs. A more detailed .rshrc is found in the the [rsh github repo](https://github.com/isene/rsh) - you can drop this into your home dir if you like. Set the basic environment variables like this:
91
+ ```
92
+ @editor = "vim"
93
+ @lscolors = "/home/geir/.local/share/lscolors.sh"
94
+ ```
95
+ The `@editor` sets your editor of choice. The `@lscolors` points to a file that sets your LS_COLORS variable. Use [my extended LS_COLORS setup](https://github.com/isene/LS_COLORS) to make this really fancy.
96
+
97
+ You can add any Ruby code to your .rshrc.
98
+
89
99
  # Enter the world of Ruby
90
100
  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.
91
101
 
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"
17
+ @version = "0.19"
18
18
 
19
19
  # MODULES, CLASSES AND EXTENSIONS
20
20
  class String # Add coloring to strings (with escaping for Readline)
@@ -422,7 +422,7 @@ def tab_switch(str) # TAB completion for command switches (TAB after "-")
422
422
  begin
423
423
  hlp = `#{str} --help`
424
424
  hlp = hlp.split("\n").grep(/^\s*-{1,2}[^-]/)
425
- hlp = hlp.map {|h| h.sub(/^\s*/, '')}
425
+ hlp = hlp.map{|h| h.sub(/^\s*/, '').sub(/^--/, ' --')}
426
426
  switch = tabselect(hlp)
427
427
  switch = switch.sub(/ .*/, '').sub(/,/, '')
428
428
  @tabsearch = switch if switch
@@ -551,9 +551,9 @@ end
551
551
  def version
552
552
  puts "rsh version = #{@version} (latest RubyGems version is #{Gem.latest_version_for("ruby-shell").version} - https://github.com/isene/rsh)"
553
553
  end
554
- def history # Show history
554
+ def history # Show most recent history (up to 50 entries)
555
555
  puts "History:"
556
- @history.each_with_index {|h,i| puts i.to_s + "; " + h}
556
+ @history.each_with_index {|h,i| puts i.to_s + "; " + h if i < 50}
557
557
  end
558
558
  def rmhistory # Delete history
559
559
  @history = []
@@ -599,6 +599,13 @@ begin # Load .rshrc and populate @history
599
599
  trap "SIGINT" do print "\n"; exit end
600
600
  firstrun unless File.exist?(Dir.home+'/.rshrc') # Initial loading - to get history
601
601
  load(Dir.home+'/.rshrc')
602
+ ENV["EDITOR"] = @editor
603
+ if File.exist?(@lscolors)
604
+ ls = File.read(@lscolors)
605
+ ls.sub!(/export.*/, '')
606
+ ls.sub!(/^LS_COLORS=/, 'ENV["LS_COLORS"]=')
607
+ eval(ls)
608
+ end
602
609
  @c = Cursor # Initiate @c as Cursor
603
610
  @c.save # Get max row & col
604
611
  @c.row(8000)
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-shell
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.17'
4
+ version: '0.19'
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-09 00:00:00.000000000 Z
11
+ date: 2023-06-12 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.17: Added the ! convention to redo history commands (like !5 to redo the 5th command
16
- in hisotry)'
15
+ 0.19: Added environment variables to .rshrc (@editor and @lscolors) and prettified
16
+ tab completions for command switches/options.'
17
17
  email: g@isene.com
18
18
  executables:
19
19
  - rsh