summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jtlib/app.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/jtlib/app.py b/jtlib/app.py
index 8e0303a..4b0c54e 100644
--- a/jtlib/app.py
+++ b/jtlib/app.py
@@ -49,6 +49,11 @@ class JournalTool(cliapp.Application):
'new entry belongs to TOPIC',
metavar='TOPIC')
+ self.settings.string_list(
+ ['templates'],
+ 'look for templates also in DIR',
+ metavar='DIR')
+
self.settings.string(
['new-note-template'],
'use FILE as the template for new journal notes',
@@ -95,6 +100,9 @@ class JournalTool(cliapp.Application):
raise cliapp.AppException('Must give at most one draft number')
def read_template(self, basename):
- filename = os.path.join(self.app_directory(), 'templates', basename)
- with open(filename) as f:
- return f.read()
+ default = os.path.join(self.app_directory(), 'templates')
+ for dirname in self.settings['templates'] + [default]:
+ filename = os.path.join(dirname, basename)
+ if os.path.exists(filename):
+ with open(filename) as f:
+ return f.read()