-
-
Notifications
You must be signed in to change notification settings - Fork 175
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
Using --data with a multiselect based choice #1474
Comments
My 2 cts (as the author of the multiselect feature): Given https://github.com/copier-org/copier/blob/master/copier/cli.py#L162-L178 is already a list, and current behavior is "last value overrides previous", I would avoid the multiple flags approach as it would mean different behavior and different parsing strategies. Between
|
I think comma-separated values won't work in general, e.g. |
Have you actually tried the array way? Something like:
|
@yajo I've tried several ways, also with an array, none works. The problem is that the answer passed via CLI is a string, which gets parsed by Line 438 in f92c1fe
which for multiselect questions does not work as expected because a list is expected: Lines 439 to 440 in f92c1fe
I'm not sure what the best solution to this problem is though. Should we support string answers for all questions, which get parsed according to the question type? |
I think the we just need a specific parser for multiselect questions. It could be a yaml that asserts the value becomes a list and casts its elements to the type of the question. |
I just stumbled into this error. I also tried all the combinations of passing date mentioned above before deciding to open an issue, an then found this existing one 🥲 |
I have the same problem. I would prefer any solution, may it be comma-separated or JSON. |
@johannesloibl rather than editing the .coper-answers.yml file directly - we have had more success by using the
|
The documentation to update, changing only one answer when the question is a multi-select base choice, is missing. This is from copier-org#1474 (comment), but it also indicate to create the `.yaml` file in another directory (to avoid error `Destination repository is dirty; cannot continue. Please commit or stash your local changes and retry.`).
* Document how to update when changing a multiselect base answer The documentation to update, changing only one answer when the question is a multi-select base choice, is missing. This is from #1474 (comment), but it also indicate to create the `.yaml` file in another directory (to avoid error `Destination repository is dirty; cannot continue. Please commit or stash your local changes and retry.`). * style: autoformat with pre-commit * docs: adapt to global copywriting style Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Jairo Llopis <973709+yajo@users.noreply.github.com>
Describe the problem
Follow on from: https://github.com/orgs/copier-org/discussions/1473
Template
To Reproduce
Logs
No response
Expected behavior
Primary:
--data is able to find the 'apple' from the 'fruit' multiselect based choice, and select it.
Secondary:
To support multiple options perhaps multiple --data entries are required akin to:
or comma separated
or an array?
Screenshots/screencasts/logs
No response
Operating system
macOS
Operating system distribution and version
Sonoma 14.2.1
Copier version
copier 9.1.0
Python version
Python 3.9.6
Installation method
pip+pypi
Additional context
No response
The text was updated successfully, but these errors were encountered: