Add `{% gitcommit short=True %}` option
sobolevn opened this issue · 3 comments
sobolevn commented
Currently this library only allows users to get the full commit hash.
I would see some possible usages of the short commit hash as well.
So, I would like to propose the following syntax for it: {% gitcommit short=True %}
.
What needs to be done?
- we need to find out how to pass parameters to the
jinja2
tags - we need to add a new parameter to the
_commit_hash
method - we need to write tests for this feature
- we need to write docs for this feature as well https://github.com/sobolevn/jinja2-git#usage
This was originally a # TODO
comment: https://github.com/sobolevn/jinja2-git/blob/23172f3a7f26b6f551f70a8c6aaa818a79918e4f/jinja2_git.py#L22
mikhail-akimov commented
I'm stuck at point 0.5: "Learn how to execute GitExtension.parse() manually".
I tried to execute the code without pytest, but I did not succeed.
sobolevn commented
Will this help you?
from jinja2 import Environment
env = Environment(extensions=['jinja2_git.GitExtension'])
template = env.from_string('Commit is: {% gitcommit %}')
This is an example from readme.
mikhail-akimov commented
I'm very ashamed. Thank you much.