Get value from DESCRIPTION
file field, cleaned up and with dynamic fallback
Source: R/pal.gen.R
desc_value.Rd
Returns the value from a DESCRIPTION
file field (aka key). Whitespaces at the start and end of the value as well as repeated whitespaces within
it are removed.
Usage
desc_value(
key,
file = ".",
default = glue::glue("<No `{key}` field set in DESCRIPTION!>")
)
Details
This function is a slightly modified version of desc::desc_get_field()
that allows the default
parameter to be dependent on the key
parameter.
By default, the following string is returned if key = "NoRealKey"
is not found:
If you rather want to take an action like throwing an error, it's recommended to call desc::desc_get_field()
directly.
See also
Other package DESCRIPTION
functions:
desc_dep_vrsn()
,
desc_list()
,
desc_url_git()
Examples
pal::desc_value(key = "Description",
file = fs::path_package("pal"))
#> [1] "A collection of convenience/utility functions complementing base R and the tidyverse."