Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

CLI for Jinja2

License

NotificationsYou must be signed in to change notification settings

mattrobenolt/jinja2-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A CLI interface to Jinja2

$ jinja2 helloworld.tmpl data.json --format=json$ cat data.json | jinja2 helloworld.tmpl$ curl -s http://httpbin.org/ip | jinja2 helloip.tmpl$ curl -s http://httpbin.org/ip | jinja2 helloip.tmpl > helloip.html

Install

$ pip install jinja2-cli

Usage

Usage: jinja2 [options] <input template> <input data>Options:  --version             show program's version number and exit  -h, --help            show this help message and exit  --format=FORMAT       format of input variables: auto, ini, json,                        querystring, yaml, yml  -e EXTENSIONS, --extension=EXTENSIONS                        extra jinja2 extensions to load  -D key=value          Define template variable in the form of key=value  -s SECTION, --section=SECTION                        Use only this section from the configuration  --strict              Disallow undefined variables to be used within the                        template

Optional YAML support

IfPyYAML is present, you can use YAML as an input data source.

$ pip install jinja2-cli[yaml]

Optional TOML support

Iftoml is present, you can use TOML as an input data source.

$ pip install jinja2-cli[toml]

Optional XML support

Ifxmltodict is present, you can use XML as an input data source.

$ pip install jinja2-cli[xml]

Optional HJSON support

Ifhjson is present, you can use HJSON as an input data source.

$ pip install jinja2-cli[hjson]

Optional JSON5 support

Ifjson5 is present, you can use JSON5 as an input data source.

$ pip install jinja2-cli[json5]

TODO

  • Variable inheritance and overrides
  • Tests!

About

CLI for Jinja2

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors12


[8]ページ先頭

©2009-2025 Movatter.jp