jinja-cli


Namejinja-cli JSON
Version 1.2.0 PyPI version JSON
download
home_pagehttps://github.com/cykerway/jinja-cli
Summarya command line interface to jinja;
upload_time2021-04-28 06:36:36
maintainer
docs_urlNone
authorCyker Way
requires_python
license
keywords jinja template engine interface
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # jinja-cli

a command line interface to [jinja][jinja];

this program renders a jinja template using input data; data may be read from a
file, environment variables, or command line arguments; either template or data
file may be read from stdin; output file may be written to stdout;

supported data formats: ini, json, xml, yaml;

## install

    pip install jinja-cli

## usage

to render a jinja template with data in json format:

    # jinja -d {data} {template}

to use a different data format:

    # jinja -d {data} -f {data_format} {template}

to read template from stdin:

    # jinja -d {data} < {template}

to read data from stdin:

    # jinja -d - {template} < {data}

to read data from command line arguments:

    # jinja -D {key} {value} [ -D {key} {value} ... ] {template}

to read data from environment variables:

    # jinja -E {key} [ -E {key} ... ] {template}

to read data from environment variables using regex:

    # jinja -X {regex} {template}

to output to a file:

    # jinja -d {data} -o {output} {template}

## example

template file `example.j2`:

    sheep eat {{ sheep.eat }};

data file `example.json`:

    {
        "sheep": {
            "eat": "grass"
        }
    }

any of these commands:

    # jinja -d example.json example.j2
    # jinja -d example.json < example.j2
    # jinja -d - -f json example.j2 < example.json

output:

    sheep eat grass;

## data priority

data priority from low to high:

-   environment variables: `-E, --env`, `-X, --env-regex`;

-   data file: `-d, --data`;

-   command line arguments: `-D, --define`;

## license

Copyright (C) 2018-2021 Cyker Way

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

[jinja]: http://jinja.pocoo.org/
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/cykerway/jinja-cli",
    "name": "jinja-cli",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "jinja template engine interface",
    "author": "Cyker Way",
    "author_email": "cykerway@example.com",
    "download_url": "https://files.pythonhosted.org/packages/21/aa/a09d6dfcaf23238df3ac18cc5dd60c6d75ef10c4b540e8796945d8b7575e/jinja-cli-1.2.0.tar.gz",
    "platform": "",
    "description": "# jinja-cli\n\na command line interface to [jinja][jinja];\n\nthis program renders a jinja template using input data; data may be read from a\nfile, environment variables, or command line arguments; either template or data\nfile may be read from stdin; output file may be written to stdout;\n\nsupported data formats: ini, json, xml, yaml;\n\n## install\n\n    pip install jinja-cli\n\n## usage\n\nto render a jinja template with data in json format:\n\n    # jinja -d {data} {template}\n\nto use a different data format:\n\n    # jinja -d {data} -f {data_format} {template}\n\nto read template from stdin:\n\n    # jinja -d {data} < {template}\n\nto read data from stdin:\n\n    # jinja -d - {template} < {data}\n\nto read data from command line arguments:\n\n    # jinja -D {key} {value} [ -D {key} {value} ... ] {template}\n\nto read data from environment variables:\n\n    # jinja -E {key} [ -E {key} ... ] {template}\n\nto read data from environment variables using regex:\n\n    # jinja -X {regex} {template}\n\nto output to a file:\n\n    # jinja -d {data} -o {output} {template}\n\n## example\n\ntemplate file `example.j2`:\n\n    sheep eat {{ sheep.eat }};\n\ndata file `example.json`:\n\n    {\n        \"sheep\": {\n            \"eat\": \"grass\"\n        }\n    }\n\nany of these commands:\n\n    # jinja -d example.json example.j2\n    # jinja -d example.json < example.j2\n    # jinja -d - -f json example.j2 < example.json\n\noutput:\n\n    sheep eat grass;\n\n## data priority\n\ndata priority from low to high:\n\n-   environment variables: `-E, --env`, `-X, --env-regex`;\n\n-   data file: `-d, --data`;\n\n-   command line arguments: `-D, --define`;\n\n## license\n\nCopyright (C) 2018-2021 Cyker Way\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see <https://www.gnu.org/licenses/>.\n\n[jinja]: http://jinja.pocoo.org/",
    "bugtrack_url": null,
    "license": "",
    "summary": "a command line interface to jinja;",
    "version": "1.2.0",
    "split_keywords": [
        "jinja",
        "template",
        "engine",
        "interface"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "9bd39494309a64fd7403685db1b2bd21",
                "sha256": "62c7c2c97c263d8c168b187d622f799dbf6c6da5ffa2a62299c513badb41094e"
            },
            "downloads": -1,
            "filename": "jinja-cli-1.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "9bd39494309a64fd7403685db1b2bd21",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 19795,
            "upload_time": "2021-04-28T06:36:36",
            "upload_time_iso_8601": "2021-04-28T06:36:36.444406Z",
            "url": "https://files.pythonhosted.org/packages/21/aa/a09d6dfcaf23238df3ac18cc5dd60c6d75ef10c4b540e8796945d8b7575e/jinja-cli-1.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-04-28 06:36:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": null,
    "github_project": "cykerway",
    "error": "Could not fetch GitHub repository",
    "lcname": "jinja-cli"
}
        
Elapsed time: 0.30785s