Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
cykerway committed Oct 12, 2018
0 parents commit df4ebe7
Show file tree
Hide file tree
Showing 14 changed files with 642 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .gitignore
@@ -0,0 +1,13 @@
# general things to ignore
build/
dist/
*.egg-info/
*.egg
*.py[cod]
__pycache__/
*.so
*~

# due to using tox and pytest
.tox
.cache
22 changes: 22 additions & 0 deletions .travis.yml
@@ -0,0 +1,22 @@
# this file is *not* meant to cover or endorse the use of travis, but rather to
# help confirm pull requests to this project.

language: python

matrix:
include:
- python: 2.7
env: TOXENV=py27
- python: 3.4
env: TOXENV=py34
- python: 3.5
env: TOXENV=py35
- python: 3.6
env: TOXENV=py36

install: pip install tox

script: tox

notifications:
email: false
15 changes: 15 additions & 0 deletions LICENSE.txt
@@ -0,0 +1,15 @@
Copyright (C) 2018 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/>.

8 changes: 8 additions & 0 deletions MANIFEST.in
@@ -0,0 +1,8 @@
# Include the README
include *.md

# Include the license file
include LICENSE.txt

# Include the data files
recursive-include data *
38 changes: 38 additions & 0 deletions README.md
@@ -0,0 +1,38 @@
# jinja-cli

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

this program renders a jinja template with given data; data may be read from a
file, or defined as command line arguments; either template or data file may be
stdin; output file may be stdout;

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

## install

pip install jinja-cli

## usage

usage: jinja [options] [template]

a command line interface to jinja;

positional arguments:
[template] template file;

optional arguments:
-h|--help display help message;
-D|--define {key} {value} define data;
-d|--data {file} data file;
-f|--format {format} data format;
-o|--output {file} output file;

### usage example

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

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

5 changes: 5 additions & 0 deletions data/example/example.ini
@@ -0,0 +1,5 @@
[DEFAULT]
eat = shit

[sheep]
eat = grass
1 change: 1 addition & 0 deletions data/example/example.j2
@@ -0,0 +1 @@
sheep eat {{ sheep.eat }};
5 changes: 5 additions & 0 deletions data/example/example.json
@@ -0,0 +1,5 @@
{
"sheep": {
"eat": "grass"
}
}
4 changes: 4 additions & 0 deletions data/example/example.xml
@@ -0,0 +1,4 @@
<?xml version="1.0"?>
<sheep>
<eat>grass</eat>
</sheep>
2 changes: 2 additions & 0 deletions data/example/example.yaml
@@ -0,0 +1,2 @@
sheep:
eat: grass
2 changes: 2 additions & 0 deletions jinja_cli/__init__.py
@@ -0,0 +1,2 @@
#!/usr/bin/env python3

0 comments on commit df4ebe7

Please sign in to comment.