This function creates a progress bar with customizable style.
Usage
progressBar(..., msg, detail, .envir = parent.frame())Arguments
- ...
Arguments passed on to
cli::cli_progress_barnameThis is typically used as a label, and should be short, at most 20 characters.
statusNew status string of the progress bar, if not
NULL.typeType of the progress bar. It is used to select a default display if
formatis not specified. Currently supported types:iterator: e.g. a for loop or a mapping function,tasks: a (typically small) number of tasks,download: download of one file,custom: custom type,formatmust not beNULLfor this type.
totalTotal number of progress units, or
NAif it is unknown.cli_progress_update()can update the total number of units. This is handy if you don't know the size of a download at the beginning, and also in some other cases. Ifformatis set toNULL,format(plusformat_doneandformat_failed) will be updated when you changetotalfromNAto a number. I.e. default format strings will be updated, custom ones won't be.formatFormat string. It has to be specified for custom progress bars, otherwise it is optional, and a default display is selected based on the progress bat type and whether the number of total units is known. Format strings may contain glue substitution, the support pluralization and cli styling. See progress-variables for special variables that you can use in the custom format.
format_doneFormat string for successful termination. By default the same as
format.format_failedFormat string for unsuccessful termination. By default the same as
format.clearWhether to remove the progress bar from the screen after it has terminated. Defaults to the
cli.progress_clearoption, orTRUEif unset.currentWhether to use this progress bar as the current progress bar of the calling function. See more at 'The current progress bar' below.
auto_terminateWhether to terminate the progress bar if the number of current units reaches the number of total units.
extraExtra data to add to the progress bar. This can be used in custom format strings for example. It should be a named list.
cli_progress_update()can update the extra data. Often you can get away with referring to local variables in the format string, and then you don't need to use this argument. Explicitly including these constants or variables inextracan result in cleaner code. In the rare cases when you need to refer to the same progress bar from multiple functions, and you can them toextra..auto_closeWhether to terminate the progress bar when the calling function (or the one with execution environment in
.envirexits. (Auto termination does not work for progress bars created from the global environment, e.g. from a script.).envirThe environment to use for auto-termination and for glue substitution. It is also used to find and set the current progress bar.
