icersplicer 0.7.0 → 0.7.2

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/bin/icersplicer +23 -7
  3. data/lib/icersplicer.rb +2 -2
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b230d59ba3efeebb5a3ebaadde17f54a77ea235
4
- data.tar.gz: 2b7e2bd69ce17fd94352006e5414a2c280f2b707
3
+ metadata.gz: ad8a1fb5ffb9396d3d8802246f9cc4d9639a14ba
4
+ data.tar.gz: 221b8664a4d7f4cd0f991a097d7adb54b9aed594
5
5
  SHA512:
6
- metadata.gz: f6aedfb1f769f17d80c46f905c9be428fe57626305929e1929070ccfefe766d3c4f8eac98d8563775cee7d66f981170f2ce095150ef9077f79e6c9c6007acbdf
7
- data.tar.gz: 8da23292ddff84de317c1729224bb707d9e6f805627672c35c10fd9d82d169eaf32284bd8dd7c256560627339a9e475d231c4fcafcf58e1d82efda581cbf379e
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
- timer = Stopwatch.new
189
- timer.watch('start')
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
- stats(inputfile, outputfile)
232
- timer.watch('stop')
233
- timer.print_stats
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
@@ -15,8 +15,8 @@ module Icersplicer
15
15
  module VERSION #:nodoc:
16
16
  MAJOR = 0
17
17
  MINOR = 7
18
- TINY = 0
19
- CODENAME = "Ice Climber !"
18
+ TINY = 2
19
+ CODENAME = "Ice Cream !"
20
20
  STRING = [MAJOR, MINOR, TINY].join('.')
21
21
  end
22
22
 
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.0
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-23 00:00:00.000000000 Z
11
+ date: 2016-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: walltime