`extra` argument to `cli_progress_update()` is either broken or lacks clear usage examples
I've been attempting to set the value of parts of a progress bar using the `extra` argument.
When I looked for any documentation above the basic usage of the `extra` argument, there is nothing to go off. None of the examples in the documentation or the vignettes use this functionality at all.
As such it's a little hard to debug whether one is simply misunderstanding how variables passed in through `extra` need to be referred to in the format string (`{extra$var1}`? `{var1}`? `{pb$extra$var1}`?), or whether there's actually a deeper bug in the way I'm calling it.
As a minimal reprex, the following code throws an error:
``` r
cli::cli_progress_bar(total = 10, format = "{testvar}{cli::pb_bar}", extra = list(testvar=1))
for (x in 1:10){
cli::cli_progress_update(extra=list(testvar=x))
Sys.sleep(1)
}
```
```
Error in `"id" %in% names(args)`:
! Could not evaluate cli `{}` expression: `testvar`.
Caused by error in `eval(expr, envir = envir)`:
! object 'testvar' not found
```
I assume I'm just misunderstanding how data should be passed to a progress bar, or how it should be referred to within a bar format string. However with no clear usage examples I'm finding it a bit hard to tease apart if it's a bug or a _me_ problem.
关闭于 2025-06-23 2 条评论