Closed NF-ada closed 1 week ago
Before considering to add a new feature related to computed values, is it an option for you to "export" computed values manually by adding a file like .copier-computed-values.yaml
(or any filename you like) like this:
my_computed_value: "{{ my_computed_value }}"
# ...
Thanks, it'll be a sufficient solution!
Actual Situation
When creating computed fields with
when: false
, make it possible to have them accessible in the answer files.I'm using
copier
to setup a project with a python script andcopier
is called within that script withrun_copy
. That way allows to access computed values without issues.I'd like my users to install copier globally though, call it from the CLI and have further setups be handled by custom scripts. As such, I need to access some computed values afterwards, from the YAML answers file.
Desired Situation
Adding an
export: true
or something similar whenwhen: false
is set such that it makes it possible to export some variables to the answers files. I think doing it per variable is best as it wouldn't impact existing usage.Proposed solution
When creating the answers file, check for fields that are both
when: false & export: true
and add them to the answers file.