bin/tracksperanto in tracksperanto-1.7.4 vs bin/tracksperanto in tracksperanto-1.7.5
- old
+ new
@@ -90,32 +90,37 @@
end
input_file = ARGV.pop
if !input_file
STDERR.puts "No input file provided - should be the last argument"
- puts parser
exit(-1)
end
class Spinner
RING = ['|', '/', '-', '\\', '|', '/', '-', '\\']
def initialize
- @counter = 0
- @last_message_length = 0
+ @counter, @last_len = 0, 0
end
def spin(percent, msg)
current = RING[(@counter += 1) % RING.length]
output = " [%s %d%%]" % [current, percent]
- STDOUT.write(output + "\r" * output.length)
+ STDOUT.write(output + ("\r" * output.length))
STDOUT.flush
+ @last_len = output.length
end
+
+ def finish(with_message = '')
+ STDOUT.write("\r" * @last_len.to_i)
+ STDOUT.flush
+ STDOUT.puts(with_message)
+ end
end
-pipe = Tracksperanto::Pipeline::Base.new
-pipe.progress_block = Spinner.new.method(:spin).to_proc
+spinner = Spinner.new
+pipe = Tracksperanto::Pipeline::Base.new(:progress_block => spinner.method(:spin).to_proc)
if sole_format
begin
pipe.exporters = [Tracksperanto.get_exporter(sole_format)]
rescue NameError
@@ -135,6 +140,7 @@
shift.y_shift = y_shift
prefix.prefix = set_prefix
lerpm.enabled = lerp
len.min_length = length_gate
end
-STDOUT.puts("\rConverted #{pipe.converted_points} trackers with #{pipe.converted_keyframes} keys")
+
+spinner.finish("Converted #{pipe.converted_points} trackers with #{pipe.converted_keyframes} keys")
\ No newline at end of file