Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Passing a bash array as an environmental variable #57

Open
nicoaws opened this issue Apr 22, 2020 · 3 comments
Open

Passing a bash array as an environmental variable #57

nicoaws opened this issue Apr 22, 2020 · 3 comments

Comments

@nicoaws
Copy link

nicoaws commented Apr 22, 2020

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

@adamwojt
Copy link

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
Copy link

merwok commented Oct 20, 2020

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

@kolypto
Copy link
Owner

kolypto commented Feb 10, 2024

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

Maintainer wanted!
Discussion: Maintainer Wanted

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants