You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want this to have the effect of using the files in the ../cargo-make/ as templates for corresponding files that are created in the cargo-make subfolder of the generated project root.
Even rhai scripts only appear to be able to rename files in the generated folder or generate files from a string or array into the generated folder. The rhai scripts don't appear to allow reading a file within a parent directory of the template directory.
Is there a way to do what I want with cargo-generate right now that I am not seeing?
Thanks a bunch!
The text was updated successfully, but these errors were encountered:
Nope, cargo-generate restricts access to files residing within the template directory for security reasons.
It could be argued that the rule should be relaxed to allow access within the repository, but that would be difficult to ensure since templates can also come from raw folders. Therefore, the template folder represents the broadest scope that is allowed.
I am also looking for something like this, in esp-rs, we will have many templates that share many of the same files, only some parts in main.rs and Cargo.toml changing. I really don't want to be duplicating a bunch of these files, across the repo.
It could be argued that the rule should be relaxed to allow access within the repository, but that would be difficult to ensure since templates can also come from raw folders
Could you expand on this a little? I don't quite understand the connection from repo root to raw folders, are they not exclusive? I.e when calling cargo generate its either a repo via --git, or a raw folder via --path. Could we at least relax the rules in the --git case?
If that isn't possible/suitable, do you have any other suggestions to achieve this? I'm happy to work on a PR.
I have a git repo with multiple generation templates.
Some of the templates have files with the same contents.
I can't find a way to use the common files to create files in the generated template.
I would like to be able to do something like.
I want this to have the effect of using the files in the
../cargo-make/
as templates for corresponding files that are created in thecargo-make
subfolder of the generated project root.Even rhai scripts only appear to be able to rename files in the generated folder or generate files from a string or array into the generated folder. The rhai scripts don't appear to allow reading a file within a parent directory of the template directory.
Is there a way to do what I want with cargo-generate right now that I am not seeing?
Thanks a bunch!
The text was updated successfully, but these errors were encountered: