class RemiLib::Console::ProgressBar(T)
- RemiLib::Console::ProgressBar(T)
- Reference
- Object
Overview
A console-based progress bar. This uses ANSI control characters to draw the bar on one line.
Defined in:
remilib/console/progress-bar.crConstructors
Instance Method Summary
-
#addEllipses=(addEllipses : Bool)
When
true
(the default), ellipses ("...") will be added to a clipped label if possible. -
#addEllipses? : Bool
When
true
(the default), ellipses ("...") will be added to a clipped label if possible. -
#allowOver100=(allowOver100 : Bool)
When
false
, then percentages that are above 100 are capped at 100. -
#allowOver100? : Bool
When
false
, then percentages that are above 100 are capped at 100. -
#done : Nil
Refreshes the bar, then prints a newline to the output and sets
#done?
totrue
. -
#done? : Bool
When
true
, then the progress bar is finished and will not refresh itself anymore or allow changes to its properties. -
#label=(newLabel : String) : Nil
Changes the label of the progress bar.
-
#labelWidth : UInt32
The maximum width for the progress bar label.
-
#labelWidth=(value : Int) : Nil
Changes the label width.
-
#max : T
The max number of steps.
-
#max=(newMax : T) : Nil
Changes the maximum value of the progress bar.
- #noAutoRefresh=(noAutoRefresh : Bool)
- #noAutoRefresh? : Bool
-
#postLabel : String | Nil
An optional label that can be printed after the percentage at the end of the progress bar.
-
#postLabel=(newLabel : String) : Nil
Changes the post-bar label of the progress bar.
-
#postLabelWidth : UInt32
The maximum width for the progress bar's post-bar label.
-
#postLabelWidth=(value : Int) : Nil
Changes the post-bar label width.
-
#pump : Nil
Increases the step by one, then refreshes the bar.
-
#refresh : Nil
Re-draws the progress bar.
-
#step : T
The current step.
-
#step=(val : T) : Nil
Sets the step to
val
, then refreshes the bar.
Constructor Detail
Instance Method Detail
When true
(the default), ellipses ("...") will be added to a clipped
label if possible.
When true
(the default), ellipses ("...") will be added to a clipped
label if possible.
When false
, then percentages that are above 100 are capped at 100. The
default is true
.
When false
, then percentages that are above 100 are capped at 100. The
default is true
.
Refreshes the bar, then prints a newline to the output and sets #done?
to true
. Calling this more than once is effectively a non-op.
When true
, then the progress bar is finished and will not refresh itself
anymore or allow changes to its properties.
Changes the label of the progress bar. This will automatically redraw the
bar unless #noAutoRefresh
is true
.
The maximum width for the progress bar label. If this is 0, then the max width is computed to be 1/5th of the width of the console.
Changes the label width. This cannot be negative. This will
automatically redraw the bar unless #noAutoRefresh
is true
.
Changes the maximum value of the progress bar. This cannot be zero or negative.
If the new maximum is greater than the current #step
, then the current
#step
is set to the new maximum.
This will automatically redraw the bar unless #noAutoRefresh
is true
.
When true
, the progress bar will not be redrawn automatically, and will
only be redrawn when #refresh
is called, or when #done
is called. The
default is false
.
When true
, the progress bar will not be redrawn automatically, and will
only be redrawn when #refresh
is called, or when #done
is called. The
default is false
.
An optional label that can be printed after the percentage at
the end of the progress bar. If this is nil
, then no extra
label is printed. This can be up to #postLabelWidth
characters
long.
Changes the post-bar label of the progress bar. This is printed after the
percentage. This will automatically redraw the bar unless
#noAutoRefresh
is true
.
The maximum width for the progress bar's post-bar label. If this is 0, then the max width is computed to be 1/5th of the width of the console.
Changes the post-bar label width. This cannot be negative. This will
automatically redraw the bar unless #noAutoRefresh
is true
.
Increases the step by one, then refreshes the bar. This will
automatically redraw the bar unless #noAutoRefresh
is true
.