Ask Questions only Once #2280
Replies: 1 comment 4 replies
-
|
I think you can modify the recipe for locking computed values to render github_username:
type: str
default: "{{ github_username | default('') }}"
when: "{{ github_username is undefined }}"# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
{{ dict(_copier_answers, github_username=github_username) | to_nice_yaml -}} There's one limitation though: You can't make this question required because |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
I love Copier and have been slowly trying to rebase all of my projects onto it.
As I've started to get more complex question sets, I'm running into more and more questions where it only makes sense for the question to be asked once during the initial copy, and, in some cases, could actually cause issues if accidentally (or intentionally) changes on
copier update.For example, the GitHub Username and GitHub Organization for a project are going to be static, unchanging values over the life of the project, and I'd like them to still be recorded in the answers file, but not asked more than once.
I've spent a while thinking about how to do this and reading the doc and I can't come up with anything. I was hopeful the newish
_copier_operationvariable could help, but it isn't available during the question phase.Is there a way to do this currently? If not, I'd love to have a conversation about potential ways to implement this, I would be happy to create a PR to add functionality in this regard, if there is desire for it from the maintainers.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions