console :: TermProgress :: display
metadata
can be used to pass a small amount of data to display after
the progress bar.
# Display the progress bar.
#
# `metadata` can be used to pass a small amount of data to display after
# the progress bar.
fun display(metadata: nullable String) do
var percent = current_percentage
var p = current_value * max_columns / max_value
printn "\r{percent}% ["
for i in [1..max_columns] do
if i < p then
printn "="
else if i == p then
printn ">"
else
printn " "
end
end
printn "]"
if metadata != null then printn " ({metadata})"
end
lib/console/console.nit:389,2--408,4