Skip to contents

Write the user-specific configuration to file. If no config is supplied, this function can create a fresh config file by copying the template to the appropriate location.

Usage

write_user_cfg(
  cfg = NULL,
  cfg_dir = NULL,
  cfg_name = NULL,
  template_dir_name = NULL,
  template_name = NULL,
  overwrite = NULL
)

Arguments

cfg

A list of nested lists, with 'leaf' nodes specifying configuration values. Default: The template config returned by generate_cfg_template()

cfg_dir

A character string specifying the config directory, or NULL for the default. Default: An OS-specific path for user configuration files in the user's home directory.

cfg_name

A character string specifying the config file name, or NULL for the default. Default: 'config.yml'

template_dir_name

A character string: the name of the config template sub-directory or NULL for the default. Default: 'config'

template_name

A character string: the name of the config template file or NULL for the default. Default: The name returned by get_cfg_template_name()

overwrite

A boolean to indicate whether an existing config file should be overwritten. Default: FALSE

Value

NULL (invisibly)

Examples

if (FALSE) { # \dontrun{
write_user_cfg()
write_user_cfg(overwrite = TRUE)

# Override a value in the config template before saving
cfg <- generate_cfg_template()
cfg <- modifyList(cfg, list(dat = list(raw = list(base = "Data-dir"))))
write_user_cfg(cfg)
} # }