summaryrefslogtreecommitdiff
path: root/subplot
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-04-03 11:04:40 +0300
committerLars Wirzenius <liw@liw.fi>2021-04-03 18:27:15 +0300
commitced4b9e5ff28016f500c5bfea91a3b33297f65d1 (patch)
treeeaa7db09063e5c1e18275981267733bf88533ce9 /subplot
parent6e60becfb6fd87b1101b97006910396132be7777 (diff)
downloadjt2-ced4b9e5ff28016f500c5bfea91a3b33297f65d1.tar.gz
feat: allow setting name of directory where new entries go
Also, some refactoring that happened along the way.
Diffstat (limited to 'subplot')
-rw-r--r--subplot/jt.py6
-rw-r--r--subplot/jt.yaml3
2 files changed, 9 insertions, 0 deletions
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