Skip to contents

Translates a plan (or a package vector that can be resolved to a plan) into shell commands appropriate for the platform's package manager.

Usage

install_command(
  x,
  platform = NULL,
  sudo = TRUE,
  update = TRUE,
  missing_only = TRUE,
  ...
)

Arguments

x

A sysreqr_plan or package vector.

platform

Platform specification accepted by resolve_platform().

sudo

Whether to prefix commands with sudo.

update

Whether to include the package manager update command when appropriate.

missing_only

Whether to include only packages not known to be installed.

...

Passed to check_packages() when x is not a plan.

Value

A character vector of shell commands.

See also

Examples

plan <- check_packages(c("xml2", "curl"), platform = "ubuntu-22.04")
install_command(plan)
#> [1] "sudo apt-get update"                                                
#> [2] "sudo apt-get install -y libcurl4-openssl-dev libssl-dev libxml2-dev"
install_command(plan, sudo = FALSE, update = FALSE)
#> [1] "apt-get install -y libcurl4-openssl-dev libssl-dev libxml2-dev"