copier-org / copier

Library and command-line utility for rendering projects templates.
https://readthedocs.org/projects/copier/
MIT License
2.06k stars 182 forks source link

Support for Creating Multiple Files from Space-Separated List Input #1847

Closed aran159 closed 2 weeks ago

aran159 commented 2 weeks ago

Actual Situation

I would like to know if it's currently possible to create multiple files based on a space-separated list input using Copier's Jinja templating.

Desired Situation

For example, if I define a CLI question like this:

my_list:
  type: str
  help: "Space separated list."
  placeholder: "value_1 value_2"

I would like to create multiple files using the following Jinja syntax:

{% for item in my_list.split() %}{{ item }}{% endfor %}

This would generate two files named value_1 and value_2.

I would expect this functionality to work similarly to the conditional files and directories feature outlined here. I have been looking for tests in the repository for this specific feature but have only found tests related to conditional files and directories.

So, I am curious if this functionality is already supported. If not, does it make sense to add this feature?

Thank you!

Proposed solution

No response

pawamoy commented 2 weeks ago

See https://github.com/copier-org/copier/issues/1271.