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

Allow update_packages() prompt to be overridden #1261

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
@@ -1,5 +1,7 @@
# devtools 1.12.0.9000

* `update_packages()` allows for override of interactive prompt (#1260, @pkq).

* Bugfix for installation of dependencies of dependencies (@jimhester, #1409).

* `RCMD()`, `clean_source()`, `eval_clean()` and `evalq_clean()` have been
Expand Down
10 changes: 7 additions & 3 deletions R/deps.R
Expand Up @@ -364,8 +364,9 @@ standardise_dep <- function(x) {
#' Works similarly to \code{install.packages()} but doesn't install packages
#' that are already installed, and also upgrades out dated dependencies.
#'
#' @param pkgs Character vector of packages to update. If \code{NULL} all
#' installed packages are updated.
#' @param pkgs Character vector of packages to update. IF \code{TRUE} all
#' installed packages are updated. If \code{NULL} user is prompted to
#' confirm update of all installed packages.
#' @inheritParams package_deps
#' @seealso \code{\link{package_deps}} to see which packages are out of date/
#' missing.
Expand All @@ -379,7 +380,10 @@ update_packages <- function(pkgs = NULL, dependencies = NA,
repos = getOption("repos"),
type = getOption("pkgType")) {

if (is.null(pkgs)) {
if (isTRUE(pkgs)) {
pkgs <- installed.packages()[, "Package"]
}
else if (is.null(pkgs)) {
if (!yesno("Are you sure you want to update all installed packages?")) {
pkgs <- installed.packages()[, "Package"]
} else {
Expand Down
6 changes: 3 additions & 3 deletions man/update_packages.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.