kolypto / j2cli

Jinja2 Command-Line Tool, reworked
http://pypi.python.org/pypi/j2cli
BSD 2-Clause "Simplified" License
744 stars 83 forks source link

Passing a bash array as an environmental variable #57

Open nicoaws opened 4 years ago

nicoaws commented 4 years ago

How would you pass a list/array argument to j2cli via the -e option?

adamwojt commented 4 years ago

I've been using this and it is workaround, remember you can use Python syntax inside jinja2: Template:

{% set my_array = env_variable.split(',') %}
{% for item in my_array %}Item is : {{ item }}
{% endfor %}

Command: env_variable="1,2,3,4" j2 ./my_template.j2 Output:


Item is : 1
Item is : 2
Item is : 3
Item is : 4
merwok commented 4 years ago

That is not a bash array, but a regular string variable that contains comma-separated values.

kolypto commented 9 months ago

Hi! This project gets some interest, but sadly, I'm not maintaining it =\

Maintainer wanted! Discussion: Maintainer Wanted