icersplicer 0.7.0 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/icersplicer +23 -7
- data/lib/icersplicer.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad8a1fb5ffb9396d3d8802246f9cc4d9639a14ba
|
4
|
+
data.tar.gz: 221b8664a4d7f4cd0f991a097d7adb54b9aed594
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd3ef0227a9f110c91b1819c5ee86794933285a3b7e6e07a744ddeb22af73f7db82f507503f2e7e0a32545148c2a1e562aeaeec298cec3106474b3a132e4d76a
|
7
|
+
data.tar.gz: 1a4b078965211dbc61ba8a55ae417dec60c0c0d440fd37019070800e34690e2fa5cfcfe0473368f8468dfd861d91830e324a6f39c5847fd7f36c208004907699
|
data/bin/icersplicer
CHANGED
@@ -26,6 +26,10 @@ def reset_screen
|
|
26
26
|
puts "\e[0m\ "
|
27
27
|
end
|
28
28
|
|
29
|
+
def filterlinestats(filterlines)
|
30
|
+
puts "\nLines Displayed by Filter: #{filterlines}"
|
31
|
+
end
|
32
|
+
|
29
33
|
trap("INT") {
|
30
34
|
puts "Goodbye see you soon!"
|
31
35
|
reset_screen
|
@@ -53,7 +57,8 @@ opts = GetoptLong.new(
|
|
53
57
|
[ '--grep', '-g', GetoptLong::REQUIRED_ARGUMENT],
|
54
58
|
[ '--nohighlighter', '-t', GetoptLong::NO_ARGUMENT ],
|
55
59
|
[ '--search', '-1', GetoptLong::REQUIRED_ARGUMENT],
|
56
|
-
[ '--replace', '-2', GetoptLong::REQUIRED_ARGUMENT]
|
60
|
+
[ '--replace', '-2', GetoptLong::REQUIRED_ARGUMENT],
|
61
|
+
[ '--nostats', '-6', GetoptLong::NO_ARGUMENT ],
|
57
62
|
)
|
58
63
|
|
59
64
|
opts.each do |opt, arg|
|
@@ -79,6 +84,7 @@ opts.each do |opt, arg|
|
|
79
84
|
--nohighlighter '-t' NO ARGUMENTS ( Turns off syntax hightlighting )
|
80
85
|
--search '-1' Text to search for
|
81
86
|
--replace '-2' Replacement string
|
87
|
+
--nostats '-6' Don't process statistics before exit
|
82
88
|
|
83
89
|
Example:
|
84
90
|
|
@@ -131,6 +137,8 @@ Written by Brian Hood
|
|
131
137
|
@search = arg.to_s
|
132
138
|
when '--replace'
|
133
139
|
@replace = arg.to_s
|
140
|
+
when '--nostats'
|
141
|
+
@nostats = "SKIP"
|
134
142
|
end
|
135
143
|
end
|
136
144
|
|
@@ -185,8 +193,11 @@ unless File.exist?("#{inputfile}")
|
|
185
193
|
exit
|
186
194
|
end
|
187
195
|
|
188
|
-
|
189
|
-
|
196
|
+
filterlines = 0
|
197
|
+
unless instance_variable_defined?("@nostats")
|
198
|
+
timer = Stopwatch.new
|
199
|
+
timer.watch('start')
|
200
|
+
end
|
190
201
|
begin
|
191
202
|
File.open(inputfile) {|n|
|
192
203
|
n.each_line {|data|
|
@@ -198,7 +209,8 @@ begin
|
|
198
209
|
unless linelimit == 0
|
199
210
|
unless increment_limit > linelimit
|
200
211
|
unless instance_variable_defined?("@skipblank") and data_orig.strip == ""
|
201
|
-
if data_orig =~ /#{grep}/
|
212
|
+
if data_orig =~ /#{grep}/
|
213
|
+
filterlines += 1
|
202
214
|
print_to_screen(linecounter, text_processor(data), quietmode) unless skip(linecounter)
|
203
215
|
if instance_variable_defined?("@outputfile")
|
204
216
|
data_orig.gsub!("#{search}", "#{replace}")
|
@@ -210,6 +222,7 @@ begin
|
|
210
222
|
else
|
211
223
|
unless instance_variable_defined?("@skipblank") and data_orig.strip == ""
|
212
224
|
if data_orig =~ /#{grep}/
|
225
|
+
filterlines += 1
|
213
226
|
print_to_screen(linecounter, text_processor(data), quietmode) unless skip(linecounter)
|
214
227
|
if instance_variable_defined?("@outputfile")
|
215
228
|
data_orig.gsub!("#{search}", "#{replace}")
|
@@ -228,7 +241,10 @@ rescue Errno::EPIPE
|
|
228
241
|
puts "Closing session due to broken pipe"
|
229
242
|
end
|
230
243
|
closefile
|
231
|
-
|
232
|
-
|
233
|
-
|
244
|
+
unless instance_variable_defined?("@nostats")
|
245
|
+
filterlinestats(filterlines)
|
246
|
+
stats(inputfile, outputfile)
|
247
|
+
timer.watch('stop')
|
248
|
+
timer.print_stats
|
249
|
+
end
|
234
250
|
reset_screen
|
data/lib/icersplicer.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: icersplicer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Hood
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: walltime
|