Jinja2 Extension for running shell commands
Project description
jinja2-shell
Jinja2 Extension for running shell commands. Makes use of subprocess.run(shell=False)
.
Installation
Install this via pip (or your favourite package manager):
pip install jinja2-shell
Usage
If the second argument is True
(default), the output is stripped of trailing whitespace and newlines. (a\n\b \n
-> a\nb
)
As statement:
{% shell "echo Hello World" %}
{% shell "echo Hello World", False %}
{% shell "echo 'Hello World', False %}
{% shell "echo \"Hello World\"", False %}
Hello World
Hello World (Ubuntu), Hello World\n (Windows)
Hello World (Ubuntu), Hello World\n (Windows)
Hello World (Ubuntu), Hello World\n (Windows)
As expression:
{{ "echo Hello World" | shell }}
{{ "echo Hello World" | shell(False) }}
{{ "echo 'Hello World'" | shell(False) }}
{{ "echo \"Hello World\"" | shell(False) }
Hello World
Hello World (Ubuntu), Hello World\n (Windows)
Hello World (Ubuntu), Hello World\n (Windows)
Hello World (Ubuntu), Hello World\n (Windows)
Contributors ✨
Thanks goes to these wonderful people (emoji key):
34j 💻 🤔 📖 |
This project follows the all-contributors specification. Contributions of any kind welcome!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
jinja2_shell-0.1.2.tar.gz
(7.9 kB
view hashes)
Built Distribution
Close
Hashes for jinja2_shell-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8619af6f6274a9101be9acc0cc2d5c42c0c3be7ca960255e9af40d4367161d5 |
|
MD5 | 14b7585a31bd44b09a33e333f8f364b9 |
|
BLAKE2b-256 | 0bb118c02b6d103be7dc5b5152ab10fb560ca4135dbb30ef1c6b191c5dca43e7 |