This function is provided to keep compatibility with `config` package, which requires existence of default key. Additionally, we can at once wrap our structure with some other keys, in order to not to mix directory structur with different keys.

as_config(x, config = "default", wrap = "dirs", ...)

# S3 method for path_chain
as_config(x, config = "default", wrap = "dirs",
  ..., root.name = "root.dir")

# S3 method for list
as_config(x, config = "default", wrap = "dirs", ...)

Arguments

x

list with directory structure

config

configuration name

wrap

key name to wrap directory structure

...

additional arguments (not used at the moment)

root.name

key for root directory (for path_chain only)

Value

list compatible with `config` package

Examples

library(magrittr) # Initalizaing sample directory tmp <- create_temp_dir("files") create_sample_dir(tmp, override = TRUE)
#> [1] TRUE
full_path_chain(tmp, "kRoot", naming_k) %>% list(kDirs = .) %>% list(default = .) %>% yaml::write_yaml(temp_path("config.yaml")) # We can simply use such function full_path_chain(tmp, "kRoot", naming_k) %>% as_config("default", "kDirs") %>% yaml::write_yaml(temp_path("config.yaml"))