Created
June 14, 2010 08:10
-
-
Save unnu/437422 to your computer and use it in GitHub Desktop.
Dotted progress bar for shell scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'stringio' | |
class Progress | |
def initialize(show) | |
@device = StringIO.new unless show | |
end | |
def device | |
@device ||= $stdout | |
end | |
def message(msg) | |
device << msg | |
device << "\n" | |
device.flush | |
end | |
def put(token = '.') | |
device << token | |
device.flush | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Interface for displaying simple progress data for import or calculation scripts.