aboutsummaryrefslogtreecommitdiff
path: root/wikijscmd/commands.py
diff options
context:
space:
mode:
authorMark Powers <mark@marks.kitchen>2022-01-23 20:45:32 -0600
committerMark Powers <mark@marks.kitchen>2022-01-23 20:45:32 -0600
commit5ad896564bb220137b500be4549bd5b714a08069 (patch)
treea14bcf25118de976aa431f089a97b76c769343a5 /wikijscmd/commands.py
parentbfade5540aa67a98ffd85fcce7ce73053565b869 (diff)
Add last_journal command
Diffstat (limited to 'wikijscmd/commands.py')
-rw-r--r--wikijscmd/commands.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/wikijscmd/commands.py b/wikijscmd/commands.py
index 86cfe7b..84f8916 100644
--- a/wikijscmd/commands.py
+++ b/wikijscmd/commands.py
@@ -85,7 +85,7 @@ def edit(path, save=False):
sys.exit(1)
print(result["message"])
-def fill_in_pages():
+def latest_journal_entry(print_result=True):
last_date = None
for page in get_tree("journal"):
try:
@@ -94,6 +94,12 @@ def fill_in_pages():
last_date = date
except ValueError:
continue
+ if print_result:
+ print(last_date)
+ return last_date
+
+def fill_in_pages():
+ last_date = latest_journal_entry(print_result=False)
today = datetime.now().date()
if last_date is None:
last_date = today