Use templated default during update #747
Unanswered
adrien-berchet
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If I have a template with something like:
I would like to create the following workflow:
copier the_template the_project
and with the following answers:a_value = a
another_value = CASE A
cd the_project; copier update
and with the following answers:a_value = b
(so we change the value)CASE B
in this example), else we keep the given custom value. In both cases the user can still change the value by answering the question if he would like.Is it possible?
To be more specific, I would like to use this workflow to migrate repositories from Gitlab to Github. In my
copier.yml
I have adestination
value that can be equal to eithergithub
orgitlab
and then I have anotherrepo_url
value which is templated according to thedestination
. When I update the project, I would like to change the URL automatically if it was set to the default value (but keep the current value if it was customized when the project was generated) before the prompt ask the new value to the user, so the user already has the correct default value in the prompt.I tried to use https://github.com/copier-org/copier-templates-extensions#context-hook-extension but I could not find a way to achieve this.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions