r-lib / cli

Tools for making beautiful & useful command line interfaces
https://cli.r-lib.org/
Other
653 stars 70 forks source link

Progress bar should handle `total = Inf` better #630

Closed mgirlich closed 2 months ago

mgirlich commented 1 year ago

This should either be an error or (I think the better option) treat it the same as total = NA

library(cli)
cli_progress_bar("Cleaning data", total = Inf)
for (i in 1:100) {
  Sys.sleep(5/100)
  cli_progress_update()
}
#> Error in "\"id\" %in% names(args)": ! Could not evaluate cli `{}` expression: `cli::pb_eta`.
#> Caused by error in `(function (fmt, ...) …`:
#> ! invalid format '%2d'; use format %f, %e, %g or %a for numeric objects

Created on 2023-09-07 with reprex v2.0.2

gaborcsardi commented 1 year ago

Yeah, agreed.