get_arg: Getting Argument From System, Option or Default

View source: R/utils.R

get_argR Documentation

Getting Argument From System, Option or Default

Description

Getting Argument From System, Option or Default

Usage

get_arg(opt = NULL, sys = NULL, default = NULL, split = ";")

Arguments

opt

(string) the name of an option.

sys

(string) the name of an environment variable.

default

value to return if neither the environment variable nor the option are set.

split

(string) the pattern used to split the values obtained using environment variable.

Value

if defined, the value of the option (opt), a character from the environment variable (sys) or the default in this order of priority.

Examples


get_arg("my.option", "MY_ARG", "default")
withr::with_envvar(c(MY_ARG = "x;y"), get_arg("my.option", "MY_ARG", "default"))
withr::with_options(c(my.option = "y"), get_arg("my.option", "MY_ARG", "default"))


dunlin documentation built on Oct. 31, 2024, 5:07 p.m.