Build directory structure from a configuration file
Value
Called for its side-effects. The directories build print as a tree-like format from fs::dir_tree()
.
Examples
tmpdir <- tempdir()
hierarchy <- "default:
paths:
data: !expr list(DEV = '/demo/DEV/username/project1/data',
PROD = '/demo/PROD/project1/data')
output: !expr list(DEV = '/demo/DEV/username/project1/output',
PROD = '/demo/PROD/project1/output')
programs: !expr list(DEV = '/demo/DEV/username/project1/programs',
PROD = '/demo/PROD/project1/programs')
docs: !expr list(DEV = 'docs',
PROD = 'docs')"
writeLines(hierarchy, file.path(tmpdir, "hierarchy.yml"))
config <- config::get(file = file.path(tmpdir, "hierarchy.yml"))
build_from_config(config, tmpdir)
#> ✔ Directories built
#> /tmp/RtmpCdc3Te
#> ├── bslib-d5bca0f1d378863417bbc07874b4d24a
#> ├── demo
#> │ ├── DEV
#> │ │ └── username
#> │ │ └── project1
#> │ │ ├── data
#> │ │ ├── output
#> │ │ └── programs
#> │ └── PROD
#> │ └── project1
#> │ ├── data
#> │ ├── output
#> │ └── programs
#> ├── docs
#> └── downlit