metwork-framework / jinja2_shell_extension

a jinja2 extension to add a filter to execute system/shell commands

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jinja2_shell_extension

Status (master branch)

GitHub CI Maintenance

What is it ?

This is a jinja2 extension to execute system/shell commands from a template.

WARNING: be sure to valid any string submitted to this filter as you can open security holes with it

Syntax

The syntax is 'full_command_with_args'|shell([die_on_error_boolean_flag], [encoding]).

Example

from jinja2 import Template, Environment

# We load the extension in a jinja2 Environment
env = Environment(extensions=["jinja2_shell_extension.ShellExtension"])

# For the example, we use a template from a simple string
template = env.from_string("Tue, 30 Apr 2024 06:25:40 +0000
")
result = template.render()

# example: result == "Fri, 31 Jan 2020 13:35:56 +0100"
# [...]

Contributing guide

See CONTRIBUTING.md file.

Code of Conduct

See CODE_OF_CONDUCT.md file.

Sponsors

(If you are officially paid to work on MetWork Framework, please contact us to add your company logo here!)

logo

About

a jinja2 extension to add a filter to execute system/shell commands

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Python 89.2%Language:Makefile 10.8%