X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bp_bin%2Fprogress_meter;h=43cdd771d0b8e38d1d5733e83404082fde78d310;hb=48bea5c28b89dc5586d0bddb338ccd6ba23aa1f9;hp=04aa0632dedbdcd0e00ac538129a81b95dbde47a;hpb=5187295e29d676c5cbc777a05dce74b9d4d62c69;p=biopieces.git diff --git a/bp_bin/progress_meter b/bp_bin/progress_meter index 04aa063..43cdd77 100755 --- a/bp_bin/progress_meter +++ b/bp_bin/progress_meter @@ -29,24 +29,24 @@ # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -require 'biopieces' +require 'maasha/biopieces' casts = [] casts << {:long=>'no_stream', :short => 'x', :type => 'flag', :mandatory => false, :default => nil, :allowed => nil, :disallowed => nil} casts << {:long=>'count', :short => 'c', :type => 'uint', :mandatory => false, :default => 1000, :allowed => nil, :disallowed => '0'} -bp = Biopieces.new +options = Biopieces.options_parse(ARGV, casts) -options = bp.parse(ARGV, casts) +Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output| + input.each_with_index do |record, count| + output.puts record unless options[:no_stream] + $stderr.printf "\n% 9d ", count if (count % (options[:count] * 100)) == 0 + $stderr.print "." if (count % options[:count]) == 0 + end -bp.each_with_index do |record, count| - bp.puts record unless options.has_key? :no_stream - $stderr.printf "\n% 9d ", count if (count % (options[:count] * 100)) == 0 - $stderr.print "." if (count % options[:count]) == 0 + $stderr.puts end -$stderr.puts -$stderr.puts count # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<