Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

templates / variables in choices #1359

Open
exitcode0 opened this issue Oct 5, 2023 · 1 comment
Open

templates / variables in choices #1359

exitcode0 opened this issue Oct 5, 2023 · 1 comment
Labels
bug triage Trying to make sure if this is valid or not

Comments

@exitcode0
Copy link

Describe the problem

I'm new to both copier and jinja so perhaps I just need to be pointed in the correct direction

I'm trying to construct the choices option on a question

Template

question_choices:
    default: ["A","B"]
    when: false

actual_question:
    help: "the cake is a lie"
    choices: ["{{question_choices}}"]
question_choices:
    default: ["A","B"]
    when: false

actual_question:
    help: "the cake is a lie"
    choices: "{% for item in {{question_choices}} -%}  - 'name': '{{item}}'{% endfor %}"

To Reproduce

No response

Logs

No response

Expected behavior

hoping to be able to generate the valid choices at run time, perhaps via script

Screenshots/screencasts/logs

No response

Operating system

macOS

Operating system distribution and version

Ventura 13.6

Copier version

copier 8.3.0

Python version

Python 3.11.5

Installation method

pip+git

Additional context

No response

@exitcode0 exitcode0 added bug triage Trying to make sure if this is valid or not labels Oct 5, 2023
@sisp
Copy link
Member

sisp commented Oct 5, 2023

I'm afraid what you'd like to do is currently not possible. See also #1193 for a previous discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug triage Trying to make sure if this is valid or not
Projects
None yet
Development

No branches or pull requests

2 participants