Crates.io | envja |
lib.rs | envja |
version | 0.2.0 |
source | src |
created_at | 2019-03-19 16:06:03.489628+00 |
updated_at | 2019-03-25 14:50:55.551002+00 |
description | Library for parsing / applying Jinja2-like syntax |
homepage | |
repository | |
max_upload_size | |
id | 122486 |
size | 12,858 |
Performs environment variable interpolation in a Jinja2-lite syntax.
Contains both the CLI and the library component.
cargo
cargo install envja
envja direct '{% if VAL %}VAL={{VAL}}{% endif %}'
Should return empty string because VAL
env var is missing.
VAL=hello envja direct '{% if VAL %}VAL={{VAL}}{% endif %}'
Should return VAL=hello
.
With similar set-up like in Direct:
echo -n '{% if VAL %}VAL={{VAL}}{% endif %}' | envja direct
echo -n '{% if VAL %}VAL={{VAL}}{% endif %}' | VAL=hello envja direct
With similar set-up like in Direct:
echo -n '{% if VAL %}VAL={{VAL}}{% endif %}' > test.tmpl
envja file test.tmpl
rm test.tmpl
echo -n '{% if VAL %}VAL={{VAL}}{% endif %}' > test.tmpl
VAL=hello envja file test.tmpl
rm test.tmpl
echo '{% if LINUX_HEADER %}#include <{{LINUX_HEADER}}>{% endif %}
int main() {
return {{ RET }};
}' > test.tmpl
LINUX_HEADER=unistd.h RET=123 envja file test.tmpl
rm test.tmpl
Should print:
#include <unistd.h>
int main() {
return 123;
}
{% if ENV %}ENV value is {{ ENV }}{% endif %}
{{ ENV }}
{# comments #}
Regular text