Skip to contents

This function has side-effects by default, see the set_as_default argument.

Usage

download_yq(
  url = NULL,
  os = NULL,
  arch = NULL,
  yq_version = "3.4.1",
  destfile = get_yq_default_path(),
  set_as_default = TRUE,
  do_check = TRUE,
  ask = TRUE,
  overwrite = FALSE,
  dry = FALSE,
  verbose = getOption("scdrake_verbose")
)

Arguments

url

A character scalar: URL from which binary will be downloaded. If NULL, it will be created from os, arch, and yq_version.

os

A character scalar: specifies the current OS ("linux", "windows", or "darwin" for macOS). If NULL, it will be determined from .Platform$OS.type.

arch

A character scalar: specifies the current CPU architecture (32, 64, or "arm64"). If NULL, it will be determined from .Machine$sizeof.pointer (4 -> 32, 8 -> 64) or from R.version for "arm64" (which is identified as "aarch64" for Apple's M1 chipsets).

yq_version

A character scalar: yq tool version.

destfile

A character scalar: destination file.

set_as_default

A logical scalar: if TRUE, set options(scdrake_yq_binary = destfile).

do_check

A logical scalar: if TRUE, functionality of the downloaded (or present) yq binary will be checked.

ask

A logical scalar: if TRUE, ask before yq binary is downloaded.

overwrite

A logical scalar: if TRUE, overwrite the existing yq binary if exists.

dry

A logical scalar: if TRUE, do not download the yq binary and just return its URL.

verbose

A logical scalar: if TRUE, be verbose. The default value is obtained from getOption("scdrake_verbose").

Value

A character scalar of length two: destfile and URL to yq binary. Note that on Windows platform, if destfile doesn't contain the .exe extension, it will be automatically added.

If !overwrite && fs::file_exists(destfile), then NULL invisibly.