Skip to contents

Reports or sets the progress style for the current session. The default, "auto", draws a bar when the session is interactive and reports nothing when it is not, which keeps a log or a CI transcript clean without asking.

Usage

getaca_progress(progress = NULL)

Arguments

progress

A style name, a reporter(), or NULL to query without setting.

Value

When querying, the reporter in effect. When setting, the previous value of the getaca.progress option invisibly, NULL if it was unset.

Details

quiet = TRUE on an individual getaca() call overrides whatever is set here, so one silent call never needs the session changed and put back.

Styles

"auto"

A bar when interactive, nothing otherwise. The default.

"bar"

A single line that redraws in place, with the share transferred, the rate and an estimate of what is left. Falls back to bytes and a rate where the registry declares no size.

"line"

One line when a transfer starts and one when it ends. What a CI log or a sink()ed script wants, where a redrawing bar leaves thousands of fragments.

"none"

Nothing at all.

Setting the style sets the getaca.progress option and nothing else, and returns what that option held before, so a caller that has to change it can put it back:

old <- getaca_progress("none")
on.exit(options(getaca.progress = old), add = TRUE)

See also

reporter() to write your own, and getaca-progress for the events one receives.

Examples

getaca_progress()

# A reporter of your own: one line per completed transfer, and nothing
# while it runs.
logger <- reporter("log", function(event) {
  if (identical(event$type, "end") && identical(event$status, "ok")) {
    message(format(event$id), " retrieved (", event$bytes, " bytes)")
  }
})
logger

# Choosing one is reversible, because the previous setting comes back.
old <- getaca_progress(logger)
getaca_progress()
options(getaca.progress = old)