From 47579d9078a42dee605af5b6853f8a7dad14afe4 Mon Sep 17 00:00:00 2001 From: Kevin Ushey Date: Mon, 21 Dec 2020 11:49:08 -0800 Subject: [PATCH] allow users to silence startup banner --- DESCRIPTION | 2 +- NEWS.md | 4 ++++ R/config-defaults.R | 9 +++++++++ R/load.R | 3 ++- inst/config.yml | 7 +++++++ man/config.Rd | 2 ++ 6 files changed, 25 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 70c97ca62..fbac7a6c7 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: renv Type: Package Title: Project Environments -Version: 0.12.3-60 +Version: 0.12.3-61 Authors@R: c( person("Kevin", "Ushey", role = c("aut", "cre"), email = "kevin@rstudio.com"), person("RStudio", role = c("cph")) diff --git a/NEWS.md b/NEWS.md index 2d71008dd..8b630df4d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,10 @@ # renv 0.13.0 (UNRELEASED) +* The configuration option `startup.quiet` has been added, allowing one to + control whether `renv` will display the typical startup banner when a + project is loaded. + * `renv` now better handles being unloaded and reloaded within the same R session. In particular, warnings related to a corrupted lazy-load database should no longer occur. (#600) diff --git a/R/config-defaults.R b/R/config-defaults.R index 3c30b46de..cc257165b 100644 --- a/R/config-defaults.R +++ b/R/config-defaults.R @@ -210,6 +210,15 @@ config <- list( ) }, + startup.quiet = function(..., default = NULL) { + renv_config_get( + name = "startup.quiet", + type = "logical[1]", + default = default, + args = list(...) + ) + }, + synchronized.check = function(..., default = TRUE) { renv_config_get( name = "synchronized.check", diff --git a/R/load.R b/R/load.R index e750d53e2..2bf0da063 100644 --- a/R/load.R +++ b/R/load.R @@ -402,9 +402,10 @@ renv_load_finish <- function(project, lockfile) { renv_load_report_project <- function(project) { - quiet <- + quiet <- config$startup.quiet() %||% ( identical(renv_verbose(), FALSE) || renv_session_quiet() + ) if (!quiet) { fmt <- "* Project '%s' loaded. [renv %s]" diff --git a/inst/config.yml b/inst/config.yml index 4257782a9..c75b325d8 100644 --- a/inst/config.yml +++ b/inst/config.yml @@ -198,6 +198,13 @@ creating `renv.lock` -- for example, if a package installed in the project library depends on a package which is not currently installed. +- name: "startup.quiet" + type: "logical[1]" + default: ~ + description: > + Be quiet during startup? When set, `renv` will not display the typical + `Project loaded. [renv ]` banner on startup. + - name: "synchronized.check" type: "logical[1]" default: true diff --git a/man/config.Rd b/man/config.Rd index abbb29f1d..efad89d1c 100644 --- a/man/config.Rd +++ b/man/config.Rd @@ -87,6 +87,8 @@ Defaults to \code{TRUE}.} Defaults to \code{TRUE}.} \item{\bold{\code{renv.config.snapshot.validate}}}{Validate \R package dependencies when calling snapshot? When \code{TRUE}, \code{renv} will attempt to diagnose potential issues in the project library before creating \code{renv.lock} -- for example, if a package installed in the project library depends on a package which is not currently installed. Defaults to \code{TRUE}.} +\item{\bold{\code{renv.config.startup.quiet}}}{Be quiet during startup? When set, \code{renv} will not display the typical \verb{Project loaded. [renv ]} banner on startup. +Defaults to \code{NULL}.} \item{\bold{\code{renv.config.synchronized.check}}}{Check that the project library is synchronized with the lockfile on load? Defaults to \code{TRUE}.} \item{\bold{\code{renv.config.updates.check}}}{Check for package updates when the session is initialized? This can be useful if you'd like to ensure that your project lockfile remains up-to-date with packages as they are released on CRAN.