Progress bar variables
These variables can be used in cli progress bar format strings.
pb_bar
creates a visual progress bar. If the number of total units
is unknown, then it will return an empty string.
pb_current
is the number of current progress units.
pb_current_bytes
is the number of current progress utils formatted
as bytes. The output has a constant width of six characters.
pb_elapsed
is the elapsed time since the start of the progress
bar. The time is measured since the progress bar is created with
cli_progress_bar()
or similar.
pb_elapsed_clock
is the elapsed time, in hh::mm::ss format.
pb_elapsed_raw
is the number of seconds since the start of the
progress bar.
pb_eta
is the estimated time until the end of the progress bar,
in human readable form.
pb_eta_raw
is the estimated time until the end of the progress
bar, in seconds.
pb_eta_str
is the estimated time until the end of the progress bar.
It includes the "ETA:"
prefix. It is only shown if the time can be
estimated, otherwise it is the empty string.
pb_extra
can be used to access extra data, see the extra
argument
of cli_progress_bar()
and cli_progress_update()
.
pb_id
is the id of the progress bar. The id has the format
cli-<pid>-<counter>
where <pid>
is the process id, and
<counter>
is an integer counter that is incremented every time
cli needs a new unique id.
pb_name
is the name of the progress bar. This is supplied by the
developer, and it is by default the empty string. A space character
is added to non-empty names.
pb_percent
is the percentage of the progress bar, always formatted
in three characters plus the percentage sign. If the total number of
units is unknown, then it is " NA%"
.
pb_pid
is the integer process id of the progress bar.
pb_rate
is the progress rate, in number of units per second,
formatted in a string.
pb_rate_raw
is the raw progress rate, in number of units per second.
pb_rate_bytes
is the progress rate, formatted as bytes per second,
in human readable form.
pb_spin
is a spinner. The default spinner is selected via a
get_spinner()
call.
pb_status
is the status string of the progress bar. By default this
is an empty string, but it is possible to set it in cli_progress_bar()
and 'cli_progress_update()].
pb_timestamp
is a time stamp in ISO 8601 format.
pb_total
is the total number of progress units, or NA
if the number
of units is unknown.
pb_total_bytes
is the total number of progress units, formatted as
bytes, in a human readable format.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # pb_bar and pb_percent
cli_progress_demo(
format = "Progress bar: {cli::pb_bar} {cli::pb_percent}",
total = 100
)
# pb_current and pb_total
cli_progress_demo(
format = "[{cli::pb_current}/{cli::pb_total}]",
total = 248
)
# pb_current_bytes, pb_total_bytes
cli_progress_demo(
format = "[{cli::pb_current_bytes}/{cli::pb_total_bytes}]",
total = 102800,
at = seq(0, 102800, by = 1024)
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.