summaryrefslogtreecommitdiff
path: root/subplot/jt.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-10-09 10:21:24 +0300
committerLars Wirzenius <liw@liw.fi>2020-10-09 10:21:24 +0300
commitbff6f54a403411e7730b405fa7ff0de81caf9f44 (patch)
tree2d4f7b1b2aff829da4ba0bfd916692aea860eded /subplot/jt.py
parent9243b189a1a12bc0ed819d59cd3cbe9ce5d37c2a (diff)
downloadjt2-bff6f54a403411e7730b405fa7ff0de81caf9f44.tar.gz
refactor: move Subplot bindings, functions files to subplot/
This makes the source tree a little cleaner, I find.
Diffstat (limited to 'subplot/jt.py')
-rw-r--r--subplot/jt.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/subplot/jt.py b/subplot/jt.py
new file mode 100644
index 0000000..2c5a4fc
--- /dev/null
+++ b/subplot/jt.py
@@ -0,0 +1,28 @@
+import logging
+import os
+
+
+def run_jt_init(ctx, dirname=None, journalname=None, title=None):
+ runcmd(ctx, [_binary("jt"), "init", dirname, journalname, title])
+
+
+def run_jt_list_journals(ctx):
+ runcmd(ctx, [_binary("jt"), "list-journals"])
+
+
+def run_jt_is_journal(ctx, dirname=None):
+ runcmd(ctx, [_binary("jt"), "is-journal", dirname])
+
+
+def _binary(name):
+ return os.path.join(srcdir, "target", "debug", "jt2")
+
+
+def is_directory(ctx, dirname=None):
+ logging.debug("checking if %r is a directory", dirname)
+ assert_eq(os.path.isdir(dirname), True)
+
+
+def output_contains(ctx, pattern=None):
+ logging.debug("checking if %r contains", ctx["stdout"], pattern)
+ assert_eq(pattern in ctx["stdout"], True)