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/RtmpQ1GZBD
#> ├── bslib-2ce9eb5d8d7866b4f2d82a9ef19eb08f
#> ├── demo
#> │ ├── DEV
#> │ │ └── username
#> │ │ └── project1
#> │ │ ├── data
#> │ │ ├── output
#> │ │ └── programs
#> │ └── PROD
#> │ └── project1
#> │ ├── data
#> │ ├── output
#> │ └── programs
#> ├── docs
#> └── downlit