arsh 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/bin/arsh +10 -0
  2. data/libs/version.rb +1 -1
  3. data/plugins/history.rb +13 -2
  4. metadata +3 -3
data/bin/arsh CHANGED
@@ -128,6 +128,11 @@ end
128
128
  end if File.exist?(arshrc)
129
129
  end
130
130
 
131
+ ArshCommands::INTHIST << File.open("#{ENV['HOME']}/.arsh_history").readlines[0..(ENV['HIST_COUNT'].to_i - 1)]
132
+ ArshCommands::INTHIST[0].map { |x| Readline::HISTORY.push(x.gsub(/^\[.*\] /,'').strip) }
133
+
134
+ at_exit { File.open("#{ENV['HOME']}/.arsh_history","w") { |f| f.puts ArshCommands::INTHIST } }
135
+
131
136
  while true
132
137
  trap('INT') do
133
138
  begin
@@ -148,6 +153,11 @@ while true
148
153
  #begin puts input.gsub(/\#\{*\}/,'\1') rescue puts "#{$!}" end
149
154
  Readline::HISTORY.push("#{input}") # Add command to history
150
155
  ArshCommands::INTHIST.push("[#{Time.now.strftime("%a %b %d %H:%M:%S")}] #{input}")
156
+ until ArshCommands::INTHIST.count <= ENV['HIST_COUNT'].to_i
157
+ a.shift if ArshCommands::INTHIST
158
+ end
159
+
151
160
  # If command is builtin to shell...
152
161
  ArshCommands.parseinput(input)
153
162
  end
163
+
data/libs/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Arsh
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.3"
3
3
  end
data/plugins/history.rb CHANGED
@@ -1,5 +1,16 @@
1
1
  module ArshCommands
2
2
  def self.history(args)
3
- puts ArshCommands::INTHIST.find_all { |x| puts x }
3
+ case args.join(" ")
4
+ when /-v/
5
+ puts ArshCommands::INTHIST
6
+ when /-h/
7
+ puts <<EOF
8
+ Usage:
9
+ -v: Verbose output; Show Timestamps.
10
+ -h: Show this message.
11
+ EOF
12
+ else
13
+ ArshCommands::INTHIST[0].map { |x| puts x.gsub(/^\[.*\] /,'') }
14
+ end
4
15
  end
5
- end
16
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arsh
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -15,7 +15,7 @@ date: 2012-01-18 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rb-readline
18
- requirement: &7508760 !ruby/object:Gem::Requirement
18
+ requirement: &6560120 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>='
@@ -23,7 +23,7 @@ dependencies:
23
23
  version: '0'
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *7508760
26
+ version_requirements: *6560120
27
27
  description: Provides a shell that can run pure Ruby code as well as ordinary linux
28
28
  commands.
29
29
  email: