-
-
Notifications
You must be signed in to change notification settings - Fork 186
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
WIP - Folder inheritance #79
Conversation
@@ -0,0 +1 @@ | |||
_extends: ./tests/demo_inheritance/conflicted/parent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this works as it is written here, I'd consider this a bug.
You cannot predict from which folder the user will launch copier. Instead, all paths should always be relative to the very copier.yml
file that defines them.
So, in this case, this should be:
_extends: ./tests/demo_inheritance/conflicted/parent | |
_extends: ../parent |
... because from this copier.yml
file, the parent folder is found there.
Also have you considered the possibility of extending several at once? We could define this as a list:
_extends: ./tests/demo_inheritance/conflicted/parent | |
_extends: | |
- ../parent |
The same applies for other test cases here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yajo Thx. I will investigate this. Please consider opening a short issue if you think there is indeed a bug or potential improvement here, so we can properly track things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, this is WIP, I don't think I need another issue, isn't it?
@@ -108,7 +116,7 @@ def copy( | |||
Skip files that already exist, without asking | |||
|
|||
- quiet (bool): | |||
Suppress the status output | |||
Suppress the status outputm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo
I am no longer pursuing this PR. |
WIP - Do not merge yet.
What this is about
This PR introduces an inheritance mechanism for template folders. Now we can have multiple child templates that inherit files and subfolders from a single parent. Thereby the need to duplicate the same set of files and subfolders among many templates is eliminated resulting in much DRYer templates.
The implementation rests upon the new optional
_extends
setting which defines a path to a parent template folder. If_extends
is a given then the referenced parent folder is rendered to the destination path before the child folder.Conflicts will be either resolved manually via the prompting mechanism or by giving
skip
/force
flags.This is some wickedly powerful feature. Maybe this is something other packages do not possess (I do not know, but could be a good selling point). I was surprised by how well it turned out working with only minimally invasive modifications to the code. Still, I am testing this further and try to evaluate all corner cases and pitfalls. Eventually, we could release this as an experimental feature.
TODO:
copier.yml
of the parent template folderextra_paths
extends
to cli argsextends
for consistency? (maybe toparent_path
)Closes: #67