Skip to content

Commit 38312c7

Browse files
author
Shambhu Shrestha
committed
jinja2
1 parent 627942e commit 38312c7

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

git/basics.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Git Basics
22

3+
## Staging / Committing
34
1. Initializing a git repo: `git init`
45
2. Add an untracked file: `git add file`. The same command is used to *stage* a tracked modified file.
56
3. Check status: `git status`. The newly added file is in *modified* state.
@@ -8,4 +9,12 @@
89
6. If a staged file is modified, the same file will appear under *staged* and *modified*.
910
7. Create a new branch and switch to it : `git checkout -b branch1`.
1011
8. See Modified unstaged changes: `git diff` (diffs modified and staged)
11-
9. See staged changes: `git diff --staged` (diffs staged and last commit)
12+
9. See staged changes: `git diff --staged` (diffs staged and last commit)
13+
10. Push changes to remote: `git push`
14+
15+
## Commit History
16+
1. Basic: `git log`
17+
2. See diff of each commit and limit log history to 2: `git log -p -2`
18+
3. With summary of files modified: `git log --stat`
19+
4. One line : `git log --oneline`
20+
5.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "{{user.name}}",
3+
"results": [ {% for item in results %} "{{item.status}}", {% endfor %}]
4+
}

python/jinja2/test.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env python3
2+
3+
from jinja2 import Environment, FileSystemLoader
4+
tpl_vars={
5+
'user':{
6+
'name' : 'shambhu',
7+
},
8+
'results':[
9+
{ 'status': 100 },
10+
{ 'status': 200 }
11+
]
12+
}
13+
if __name__ == '__main__':
14+
env = Environment(loader=FileSystemLoader('./templates'))
15+
template = env.get_template('config.json')
16+
print(template.render(tpl_vars))
17+

0 commit comments

Comments
 (0)