summaryrefslogtreecommitdiff
path: root/patternutils/commands/targs.py
diff options
context:
space:
mode:
Diffstat (limited to 'patternutils/commands/targs.py')
-rw-r--r--patternutils/commands/targs.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/patternutils/commands/targs.py b/patternutils/commands/targs.py
index 59a8ab3..c1db5e4 100644
--- a/patternutils/commands/targs.py
+++ b/patternutils/commands/targs.py
@@ -15,6 +15,7 @@ from typing import (
import click
from .. import template
+from .. import config
def run_command(
@@ -41,6 +42,8 @@ def run_command(
@click.option('-v', '--verbose', is_flag=True, default=False,
help='explain what is being done')
@click.option('-P', '--max-procs', default=1, type=click.IntRange(min=0, clamp=True))
+@click.option('-p', '--use-predefined-template', is_flag=True, default=False,
+ help='use predefined template')
@click.option('--redirect-stdout', is_flag=True, default=False,
help='Redirect stdout to /dev/null')
@click.option('--redirect-stderr', is_flag=True, default=False,
@@ -55,6 +58,7 @@ def targs(
max_procs: int,
redirect_stdout: bool,
redirect_stderr: bool,
+ use_predefined_template: bool,
verbose: bool,
) -> None:
@@ -64,7 +68,9 @@ def targs(
click.secho('JSON not valid!', fg='red', err=True)
raise SystemExit
- use_jinja = True if template_engine == 'jinja2' else False
+ if use_predefined_template:
+ template_engine, comand = config.load_template(command, 'targs')
+
try:
render = template.get_render_function(command, engine=template_engine)
except RuntimeError: