Giter Site home page Giter Site logo

Ask question only once about copier HOT 3 CLOSED

henningWoehr avatar henningWoehr commented on May 28, 2024 1
Ask question only once

from copier.

Comments (3)

debo avatar debo commented on May 28, 2024

I would like to chip in but with a different consideration suggestion but on a similar note.

I do believe that the default behaviour should be to just replay the previous answers unless otherwise specified in general. So basically instead of needing to be explicit with:

$ copier update --defaults

Making it implicit and possibly swap the behaviour for something like:

$ copier update --new-answers

What do people think? Or is there a specific technical reasoning as of why the current behaviour is the way it is?

from copier.

yajo avatar yajo commented on May 28, 2024

@debo that's a different subject. I marked your comment as off-topic to keep the conversation focused. Feel free to open a new issue or discussion about that.

Back into the subject, it's not a trivial request. Adding support for this would require completely refactoring the logic of how and why we manage the state of the project, which is tailored to our use case.

The use case for copier as a tool is to let you provide new answers and make those answers change the resulting project. This thing you want fits more into a validation tool, such as a pre-commit hook, CI or linter, that forbids unwanted changes. After all, what if you do that change manually, without copier involved? You'd also delete the cluster resources...

However you can be creative. For example, you could deploy your manifests with kustomize, and set the name and namespace in a patch file. Then, add that file to _skip_if_exists and copier won't update it anymore.

If I don't want users to update values of a question, I'd just add a big warning in the question help.

Another option would be to use a validation based on a computed previous value. I haven't tested this but it could help:

old:
  type: str
  when: false
  default: '{{ resource_name|d("") }}'

resource_name:
  type: str
  help: What is the name for the resources which will be applied in k8s? (Can't be changed afterwards)
  answer_once: true
  default: container-registry
  validator: "{{not old or resource_name == old}}"

from copier.

yajo avatar yajo commented on May 28, 2024

Closing because I think there's nothing we could or should do here, but please feel free to continue with the discussion. Thanks for reaching out!

from copier.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.