Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Quiet" progress bars #645

Open
hadley opened this issue Nov 9, 2023 · 3 comments
Open

"Quiet" progress bars #645

hadley opened this issue Nov 9, 2023 · 3 comments
Labels
feature a feature request or enhancement tidy-dev-day 🤓 Tidyverse Developer Day rstd.io/tidy-dev-day

Comments

@hadley
Copy link
Member

hadley commented Nov 9, 2023

It's pretty common to have an option that controls whether or not progress bars appears, which leads to code like this:

  if (!quiet) {
    cli::cli_progress_bar(
      format = "Running job {x} [:spin] :elapsed",
      total = NA,
      clear = FALSE
    )
  }

  repeat {
    if (!quiet) cli::cli_progress_update()
    # https://cloud.google.com/bigquery/docs/error-messages
    # Switch to req_retry() when we move to httr2
    status <- tryCatch(
      bq_job_status(x),
      bigrquery_http_503 = function(err) NULL
    )
    if (!quiet) cli::cli_progress_update()

    if (!is.null(status) && status$state == "DONE") break
    Sys.sleep(pause)
  }
  if (!quiet) cli::cli_progress_done()

It'd be nice if there was an option to cli_progress_bar() that generated a quiet bar.

@gaborcsardi gaborcsardi added the feature a feature request or enhancement label Nov 9, 2023
@robchallen
Copy link

If you are considering this then I would value a global option to completely suppress progress bar output, mostly so I can switch progress bars off when I move from interactively running markdown chunks in RStudio to knitting a rmarkdown document, when I want to suppress the progress bars in the output.

maybe the new parameter in cli_progress_bar() could reference a global option , e.g.

cli_progress_bar = function( <snip>, quiet = getOption("cli.disable_progress",FALSE) ,  <snip> ) { <snip> }

@robchallen
Copy link

N.B. my particular use case overlaps with #583

@hadley
Copy link
Member Author

hadley commented May 16, 2024

@robchallen IMO we should do that automatically for you

@gaborcsardi gaborcsardi added the tidy-dev-day 🤓 Tidyverse Developer Day rstd.io/tidy-dev-day label Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement tidy-dev-day 🤓 Tidyverse Developer Day rstd.io/tidy-dev-day
Projects
None yet
Development

No branches or pull requests

3 participants