From 1ac22bf82d12fad9b3019d96d27fd3d2b3455289 Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Fri, 25 Sep 2020 21:22:53 +0200 Subject: Use conditional expression to set fileext in patterncfg add --- patternutils/commands/patterncfg.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/patternutils/commands/patterncfg.py b/patternutils/commands/patterncfg.py index 3ef0518..83168cf 100644 --- a/patternutils/commands/patterncfg.py +++ b/patternutils/commands/patterncfg.py @@ -61,10 +61,7 @@ def add(template_engine: Optional[str], command: str, name: str) -> None: if command == "pmatch": fileext = "regex" else: - if template_engine not in ("python", "jinja2"): - fileext = "python" - else: - fileext = template_engine + fileext = "jinja2" if template_engine == "jinja2" else "python" filename = os.path.join(config.CONFIG_PATH, command, f"{name}.{fileext}") click.edit(filename=filename) -- cgit v1.3.1