Identifies system running and pulls the relevant tarball for the current release of bbi from GitHub, and then installs it at .path (see Details section for defaults). If used in an interactive session, will open an installation menu confirming the installed version. This function will print information about the installed version. This printing can be suppressed by setting options(bbr.verbose = FALSE).

use_bbi(.path = NULL, .version = "latest", .force = FALSE, .quiet = NULL)

Arguments

.path

path to install bbi to. See Details section for defaults, if nothing is passed. Note that this should be the path where you would like the bbi executable to be installed, not the path to the directory in which you want to install it. For example, you should pass "/some/dir/bbi" and not "/some/dir".

.version

version of bbi to install. Must pass a character scalar corresponding to a tag found in https://github.com/metrumresearchgroup/bbi/releases

.force

If FALSE, the default, skips installation if requested version and local version are the same. If TRUE forces installation if it will be the same version.

.quiet

Deprecated. Use options("bbr.verbose") instead to control printing. Defaults to NULL, which reads !getOption("bbr.verbose"). If TRUE, suppresses output printed to the console.

Value

character

Details

If nothing is passed to the .path argument, use_bbi() will attempt to find a valid path for installation. The following decision waterfall is used:

  • First, check getOption("bbr.bbi_exe_path"). If this is anything other than "bbi" (the default value) then attempt to install to that path.

  • Second, check Sys.which("bbi") which will look for a bbi installation in the user's $PATH. If one is found, ask the user if they wish to overwrite it and, if they confirm, install to that path.

  • Third, attempt to install to a "default location" and add this location to the user's $PATH. If Sys.getenv("XDG_DATA_HOME") is found, install to {Sys.getenv("XDG_DATA_HOME")}/bbi/bbi (per XGD specification). Otherwise, install to OS dependent defaults:

    • Linux: {Sys.getenv("HOME")}/.local/share/bbi/bbi

    • Mac: /usr/local/bin/bbi

    • Windows: {Sys.getenv("APPDATA")}\bbi\bbi

If none of these are successful, the user will be prompted to set options("bbr.bbi_exe_path") and try again.