-
-
Notifications
You must be signed in to change notification settings - Fork 168
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
Conditional exclude items #1625
Comments
Are you aware that Copier allows to do that thanks to file names? A file named More generally, a file with an empty name will not be created (it would be impossible to create it anyway). Same for directories, although they don't need the |
Not exactly, because the file in question is configuring the template, it cannot have any other name. That file has to exist as is, and excluded on copy conditionally. At the moment I have to overwrite it and make it clean not to copy my template's config over, but it is not used in the destination. Does it make sense? |
Oh, IIUC you have files that are used both for maintaining the template, and as files to copy to destination projects. Interesting. I'd recommend keeping two separate copies indeed, and using the subdirectory feature to separate them. Just my opinion but if you need to change config for your template you might not want this change to apply to projects too? Better explicit than implicit? |
Other than that, no strong opinion :) If other maintainers think this feature is worth it, I won't mind. |
Yeah, let me give you an example. I have a
|
Actually could you post snippets of your file layout? Because it's quite hard to understand how exactly you're using Copier from text alone.
Could you elaborate on that? I'm not sure to understand either. |
Here an example. The Regarding the CI that I mentioned. I have a Hope this makes it all clearer. |
OK I see, thanks a lot 🙂
Yeah that's one of the challenges I'm facing indeed. Tracking my progress here: pawamoy/copier-uv#24. |
I am running into the same issue. I can't edit the file name because it is needed for the template itself to run some checks. I tried to create a duplicate filename and then add that to the exclude but it ends up skipping both directories. |
Actual Situation
I would like to exclude files / folders conditionally in the
copier.yaml
file. Currently, if you add a file/folder to the exclude list, it is always excluded, even if there is a suffixed file that converts. Therefore, the exclusion list applies to the result (this has been discussed in past issues).My real use case is that I have a few configuration files that apply to my template, and may or not apply to the destination depending on a certain variable. If they don't apply to the destination I would like to exclude them and not copy irrelevant files. If they apply, I would not exclude and normal overwrite rules apply.
Desired Situation
Being able to exclude files/folders conditionally would allow having config files in my template that are copied over conditionally on variables. This would be a new powerful feature.
Proposed solution
I would like to have something in the
copier.yaml
that would allow me to exclude files/folders:I think this solution would not impact current behavior of exlusions applying to final names. It just modifies applying the exclusion conditionally.
The text was updated successfully, but these errors were encountered: