julia> ]add https://github.com/psrenergy/IncrementalProgressBar.jl
Currently, there are two types of progress bars available:
The iterative progress bar keeps overwriting the same line in the terminal, updating as it progresses.
The incremental progress bar does not overwrite the whole terminal line. It adds new ticks to the end of the line as it progresses.
Note It is advised to use the incremental progress bar when your terminal cannot overwrite the terminal line.
The progress bar can be costumized by passing the following arguments to the ProgressBar
constructor:
-
display
: The type of progress bar to be displayed (IncrementalProgressBar.Incremental
orIncrementalProgressBar.Iterative
). -
maximum_steps
(Int): The maximum number of steps the progress bar will take. -
tick
(Char): The character that will be used to represent the progress bar (".", "*", "+", etc.). -
first_tick
(Char): The leading tick of the progress bar (">", etc.) -
left_bar
(Char): The character that will be used to represent the left bar of the progress bar ("|", "[", etc.). -
right_bar
(Char): The character that will be used to represent the right bar of the progress bar ("|", "]", etc.). -
maximum_length
(Int): The width of the progress bar in characters. -
color
(Symbol): The color of the progress bar (e.g.:red
,:green
,:blue
, etc.). -
has_percentage
(Bool): Whether to show the percentage of the progress bar or not. -
has_frame
(Bool): Whether to show a top and bottom frame of the progress bar or not. -
has_eta
(Bool): Whether to show the estimated time of arrival or not. -
has_elapsed_time
(Bool): Whether to show the elapsed time or not.
using IncrementalProgressBar
p = IncrementalProgressBar.ProgressBar(maximum_steps = 100, tick = "+", left_bar = "|", right_bar="|")
for i in 1:100
IncrementalProgressBar.next!(p)
sleep(0.1)
end
IncrementalProgressBar.done!(p)