arsh 1.0.5 → 1.0.6
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.
- data/bin/arsh +29 -13
- data/libs/version.rb +1 -1
- metadata +4 -4
data/bin/arsh
CHANGED
@@ -5,13 +5,13 @@ require 'rb-readline'
|
|
5
5
|
|
6
6
|
Dir.glob("#{ARSH_INSTALL_PATH}/libs/*.rb").each { |mod| load(mod) }
|
7
7
|
trap('QUIT',"IGNORE")
|
8
|
-
trap('INT') do
|
9
|
-
begin
|
10
|
-
break
|
11
|
-
rescue
|
12
|
-
print "^C"
|
13
|
-
end
|
14
|
-
end
|
8
|
+
#trap('INT') do
|
9
|
+
# begin
|
10
|
+
# break
|
11
|
+
# rescue
|
12
|
+
# print "^C"
|
13
|
+
# end
|
14
|
+
#end
|
15
15
|
## Set up some default variables
|
16
16
|
$ps1="(arsh)<% ENV['USER'] %>@<% Dir.pwd %>$ "
|
17
17
|
$ps2=">"
|
@@ -31,6 +31,9 @@ Readline.completion_proc = lambda do |search|
|
|
31
31
|
if files.select { |f| f =~ %r[^#{search}] }.empty?
|
32
32
|
files = ArshCommands.search_path(files)
|
33
33
|
end
|
34
|
+
if files.select { |f| f =~ %r[^#{search}] }.empty?
|
35
|
+
files = ArshCommands.search_all(search)
|
36
|
+
end
|
34
37
|
end
|
35
38
|
# Complete builtin methods
|
36
39
|
ArshCommands.singleton_methods.each { |method| files << method if method =~ /^#{search}/ }
|
@@ -74,8 +77,8 @@ module ArshCommands
|
|
74
77
|
puts "#{$!}"
|
75
78
|
end
|
76
79
|
# If (full path) file is executable..
|
77
|
-
elsif File.exists?(cmd) && File.executable?(cmd)
|
78
|
-
system("#{cmd} #{parms}")
|
80
|
+
elsif File.exists?(cmd) && File.executable?(cmd)
|
81
|
+
system("#{cmd} #{parms.join(' ')}")
|
79
82
|
# If file is in PATH
|
80
83
|
elsif ArshCommands.in_path?(cmd,parms) == false
|
81
84
|
# Try to run input as ruby code.
|
@@ -84,7 +87,7 @@ module ArshCommands
|
|
84
87
|
end
|
85
88
|
|
86
89
|
def self.search_current_directory(files,search)
|
87
|
-
Dir["#{search.gsub(%r[^/],"")}*"].each { |f| files << f }
|
90
|
+
Dir["#{search.gsub(%r[^/],"")}*"].each { |f| files << f if File.directory?(f) || File.executable?(f) }
|
88
91
|
|
89
92
|
files.map! { |f| f.gsub(%r[#{Dir.pwd}/],"") }.map! { |f| File.directory?(f) ? f + "/" : f }
|
90
93
|
|
@@ -103,6 +106,12 @@ module ArshCommands
|
|
103
106
|
end
|
104
107
|
return files
|
105
108
|
end
|
109
|
+
|
110
|
+
def self.search_all(search)
|
111
|
+
files = Dir.glob("#{search}*")
|
112
|
+
files.map! { |f| File.directory?(f) ? "#{f}/" : f }
|
113
|
+
return files
|
114
|
+
end
|
106
115
|
end
|
107
116
|
|
108
117
|
# Load Plugins
|
@@ -121,12 +130,19 @@ end
|
|
121
130
|
end
|
122
131
|
|
123
132
|
while true
|
124
|
-
|
125
|
-
|
133
|
+
trap('INT') do
|
134
|
+
begin
|
135
|
+
break
|
136
|
+
rescue
|
137
|
+
print "^C"
|
138
|
+
break
|
139
|
+
end
|
140
|
+
end
|
126
141
|
begin
|
127
142
|
prompt = ArshCommands.rubyeval_indent == 0 ? $ps1 : "#{$ps2 * ArshCommands.rubyeval_indent} "
|
128
143
|
input = Readline::readline(ArshCommands.replacestring(prompt)).to_s.strip
|
129
|
-
rescue
|
144
|
+
rescue Exception => e
|
145
|
+
puts e
|
130
146
|
puts ""
|
131
147
|
input = ""
|
132
148
|
end
|
data/libs/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arsh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1414957331145679041
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 6
|
10
|
+
version: 1.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- James Paterni
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date:
|
20
|
+
date: 2012-01-12 00:00:00 -05:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|