Jinja2 filter extension for detecting if a directory is a git repository
Project description
Git Directory Extension
Jinja2 filter extension for detecting if a directory is a git repository.
Usage
Examples:
- Detect if
git_pathis a git directory
{{ git_path | gitdir }} - Assert that
git_pathis a git directory
{{ git_path | gitdir is true }} - Assert that
git_pathis NOT a git directory
{{ git_path | gitdir is false }} - Using
gitdirin a conditional
{% if (git_path | gitdir) %}{{ git_path }} is a git directory{% else %}no git directory at {{ git_path }}{% endif %}
Copier
This can be utilized within a Copier copier.yaml file for determining if the destination
path is already initialized as a git directory.
Example:
This will configure a Copier _task to run git init but only if the destination
path isn't already a git directory.
_jinja_extensions:
- jinja2_git_dir.GitDirectoryExtension
_tasks:
- command: "git init"
when: "{{ _copier_conf.dst_path | realpath | gitdir }}"
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jinja2_git_dir-0.1.0.tar.gz.
File metadata
- Download URL: jinja2_git_dir-0.1.0.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab891c61b1692975b2665f6ae0fcc42ad4d14e79a66527eb2ed6b207c9a98091
|
|
| MD5 |
fa78ad4a004410c18d25f9807e07bf70
|
|
| BLAKE2b-256 |
1c663d35dff741fe35e6299560263d05f2dd3b666fd90bdd21154469ac73495a
|
File details
Details for the file jinja2_git_dir-0.1.0-py3-none-any.whl.
File metadata
- Download URL: jinja2_git_dir-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f1428c992deb1dcd14cfaa7ef82d97cb9ae8cc2d3af9616fa49cb3dd1961b90
|
|
| MD5 |
b86c131008e7b7636c7a93ff631f8f30
|
|
| BLAKE2b-256 |
67ee22969aa09c5d14c6a4816fd6b1d4226bb50e2147b4b29acb205e03e62943
|