Generate parameter documentation based on option behaviors. Especially useful for ubiquitous function parameters that default to option values.
See also
Other options_roxygen2:
as_roxygen_docs()
Examples
options::define_options(
"whether messages should be written softly, or in all-caps",
quiet = TRUE
)
#>
#> quiet = TRUE
#>
#> whether messages should be written softly, or in all-caps
#>
#> option : globalenv.quiet
#> envvar : R_GLOBALENV_QUIET (evaluated if possible, raw string otherwise)
#> *default : TRUE
#>
#' Hello, World
#'
#' @eval options::as_params("softly" = "quiet")
#'
hello <- function(who, softly = opt("quiet")) {
say_what <- paste0("Hello, ", who, "!")
if (quiet) say_what else toupper(say_what)
}