Coder Social home page Coder Social logo

envja's Introduction

Envja

Codefresh build status

Performs environment variable interpolation in a Jinja2-lite syntax.

Contains both the CLI and the library component.

How to install CLI

Via cargo

cargo install envja

Simple Examples

Direct

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.

Direct via STDIN

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

Via file

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

Complex Example

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;
}

Syntax Acceptance

If-statement

{% if ENV %}ENV value is {{ ENV }}{% endif %}

Expression

{{ ENV }}

Comments

{# comments #}

Regular text

Regular text

envja's People

Contributors

guangie88 avatar

Stargazers

 avatar

Watchers

 avatar

envja's Issues

Allow processing of list?

Should be possible to inject JSON value as string into any env var, then when used in for loop context, the var can be interpreted as a list value.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.