Create output directories if they do not exist
- Dominant language
- Jsonnet
- Stars
- 7.6k
- Forks
- 475
- PR merge metrics
- No merged PRs in 30d
Description
I'd like to be able to invoke jsonnet like: `jsonnet -o foo/bar.json -e "{ foo: 'bar' }"` and have it create the `foo/` directory if it does not already exist. I'd like this to apply to multi-file output invocations as well. My use case is to have a file of the form:
```
{
'a.json': { /* snip */ },
'subdir/b.json': /* ... */,
'subdir/c.json': /* ... */,
}
```
but I'd like to be able to invoke `jsonnet -m` without having to know which subdirectories to create beforehand.
Currently, both invocations fail with the error:
```
$ jsonnet -o foo/bar.json -e "{ foo: 'bar' }"
Writing to output file: foo/bar.json: No such file or directory
$ jsonnet -m . foo.jsonnet
./a.json
./subdir/b.json
Opening output file: ./subdir/b.json: No such file or directory
```
Contributor guide
Assessment
This issue has not been assessed yet.