mirror of
https://github.com/TECHNOFAB11/docsonnet.git
synced 2026-02-02 15:45:12 +01:00
feat: render directory structure instead of flat file names (#20)
* feat: render directory structure instead of flat file names * add gitignore
This commit is contained in:
parent
1f8d4c6fbf
commit
5776ff829f
3 changed files with 16 additions and 9 deletions
|
|
@ -17,7 +17,12 @@ func To(pkg docsonnet.Package, dir string, opts Opts) (int, error) {
|
|||
|
||||
n := 0
|
||||
for k, v := range data {
|
||||
if err := ioutil.WriteFile(filepath.Join(dir, k), []byte(v), 0644); err != nil {
|
||||
fullpath := filepath.Join(dir, k)
|
||||
dir := filepath.Dir(fullpath)
|
||||
if err := os.MkdirAll(dir, os.ModePerm); err != nil {
|
||||
return n, err
|
||||
}
|
||||
if err := ioutil.WriteFile(fullpath, []byte(v), 0644); err != nil {
|
||||
return n, err
|
||||
}
|
||||
n++
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue