Replies: 2 comments 4 replies
-
If you watch the recording in #317 (comment), you can see one of the scenarios that would trigger a problematic case.
You can see it really does. It stores answers separately to be able to distinguish them: copier/copier/config/objects.py Lines 134 to 144 in 62d38a8
This seems like a wrong usage of that file too. The common place to store docs about questions is Also, if your template evolved and modified, added or removed some questions, how is your user supposed to know that by just looking at his last answers?
I think it's more important to know why. You say you don't like to use If all you want is to forbid writes to specific files, possibly a pre-commit check is a better tool for that. You seem to be trying to forbid your template users to smart update their projects, but I don't think you should. Usually you either don't support updates at all (in which case your template is bootstrap-only) or support them and let your users to evolve their subprojects freely. If you opt for supporting only bootstrapping, #235 would help to avoid repeating stuff. If you opt to support updates, then the recopy command explained in #302 (comment) would let your users choose to update or recopy. I think it's a decision that belongs to the user. OTOH another way to improve usage experience would be to support passing in a data file instead of only individual data flags. |
Beta Was this translation helpful? Give feedback.
-
BTW, have you tried passing |
Beta Was this translation helpful? Give feedback.
-
This question spun off of #313 but was getting off topic there; moving to an issue more directly associated with the topic at hand.
I understand what you're saying (and that #317 is documenting) but I think I'm still confused on how that is/would happen, especially since I haven't seen what is being described. When
copier
reads.copier-answers.yml
and it has those answers + templates, how does it tell the difference between an answer in.copier-answers.yml
and one provided via the command line? In the cases I've seen it simply renders the templates with the answers and writes out the files, thus resulting in the behavior I desire of being able to change.copier-answers.yml
and having it update the files.I think the broader question is how can/could this be supported? Using
--data
doesn't seem very user friendly, as it requires a user to know all the things they could set, and type it correctly. In our case, the.copier-answers.yml
holds those options, as well as documentation on what they do and what it could/should be set to. So from a usage perspective, that's an ideal entry point to findquestion_1
and see the answer, see what it does, what the options are, if it's non-conforming and change right there. It also is potentially a nicer way to bootstrap a project, where I copy a file of an existing project as a starting point rather than have to answer a bunch of questions.One item that I just thought of that I noted on a different issue that might be responsible for some of what I'm seeing is that I am specifically removing
_commit
from the.copier-answers.yml
specifically because I'm trying to avoid theupdate_diff
code path. Perhaps that's the code path that is doing the detection you're talking about, and where updating.copier-answers.yml
directly isn't supported and won't affect the generated files? In that case, is updating.copier-answers.yml
directly supported with thecopy
command? If so maybe this all boils down to me wanting thatrecopy
command you mention on that issue, sinceupdate
is enforcing some workflow that I don't personally want for updates?If this is the case, an unfortunate side effect of forcing down the
copy_local
code path (which I want for both initial layout and later updates) is thatshutil.rmtree
which blows away my working directory often if anything isn't right. It'd be nice per #302 if I could tell copier (and if it was the default) to not delete my directory no matter what workflow it thinks it's using.Beta Was this translation helpful? Give feedback.
All reactions