From ced4b9e5ff28016f500c5bfea91a3b33297f65d1 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 3 Apr 2021 11:04:40 +0300 Subject: feat: allow setting name of directory where new entries go Also, some refactoring that happened along the way. --- subplot/jt.py | 6 ++++++ subplot/jt.yaml | 3 +++ 2 files changed, 9 insertions(+) (limited to 'subplot') diff --git a/subplot/jt.py b/subplot/jt.py index 312a22a..6ce75b0 100644 --- a/subplot/jt.py +++ b/subplot/jt.py @@ -153,3 +153,9 @@ def file_contains(ctx, variable=None, pattern=None): data = f.read() logging.debug(f"file content: {data!r}") assert pattern in data + + +def file_name_has_suffix(ctx, varname=None, suffix=None): + variables = ctx.get("variables", {}) + filename = variables[varname] + assert filename.endswith(suffix) diff --git a/subplot/jt.yaml b/subplot/jt.yaml index 187f436..65bf90e 100644 --- a/subplot/jt.yaml +++ b/subplot/jt.yaml @@ -54,3 +54,6 @@ - then: journal entry <{variable}> contains "{pattern:text}" function: file_contains + +- then: file name <{varname}> ends with {suffix} + function: file_name_has_suffix -- cgit v1.2.1