Crates.io | envja-cli |
lib.rs | envja-cli |
version | 0.2.0 |
source | src |
created_at | 2019-03-19 16:08:04.773434 |
updated_at | 2019-03-25 14:51:37.577992 |
description | CLI for Jinja2-like env var interpolation |
homepage | |
repository | |
max_upload_size | |
id | 122487 |
size | 3,609 |
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