Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for recursive source -> target generation #17

Open
Avataw opened this issue May 7, 2024 · 2 comments
Open

Add support for recursive source -> target generation #17

Avataw opened this issue May 7, 2024 · 2 comments

Comments

@Avataw
Copy link
Contributor

Avataw commented May 7, 2024

It would be great to be able to recursively add a whole folder.

Something like:

  - source: "templates/some_folder/*"
    target: "some_folder"
@StephanHCB
Copy link
Owner

StephanHCB commented May 10, 2024

This is actually already somewhat supported, provided there is a limit to how deep the folder tree goes, and assuming you give your template files a common extension.

  - source: '{{ .file }}'
    target: 'output/{{ .file | replace ".tmpl" "" }}'
    with_files:
      - 'templates/some_folder/*.tmpl'
      - 'templates/some_folder/*/*.tmpl'
      - 'templates/some_folder/*/*/*.tmpl'
      - 'templates/some_folder/*/*/*/*.tmpl'
      - 'templates/some_folder/*/*/*/*/*.tmpl'

Unfortunately, golang package filepath does not support ** in its Glob function, that's why you have to spell out the nesting levels, and it's limited to 4 directory levels I believe.

The feature is mentioned briefly in the readme, look for with_files.

Support for ** would be great, though, so I'll keep this issue open. Will have to go on the lookout for a better Glob function than filepath.Glob.

@StephanHCB
Copy link
Owner

Or we wait for golang/go#11862 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants