summaryrefslogtreecommitdiff
path: root/journal-reminder.ros
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2018-06-13 21:36:56 -0700
committerBen Sima <ben@bsima.me>2018-06-13 21:36:56 -0700
commit77c9a177b2b595d4ce25095b58e2388fe33cc97a (patch)
tree0853d5c92d67538760005b9c4635a90115bd7ba4 /journal-reminder.ros
init
Diffstat (limited to 'journal-reminder.ros')
-rwxr-xr-xjournal-reminder.ros36
1 files changed, 36 insertions, 0 deletions
diff --git a/journal-reminder.ros b/journal-reminder.ros
new file mode 100755
index 0000000..500be53
--- /dev/null
+++ b/journal-reminder.ros
@@ -0,0 +1,36 @@
+#!/bin/sh
+#|-*- mode:lisp -*-|#
+#|
+exec ros -Q -- $0 "$@"
+|#
+
+(defpackage :me.bsima.journal-reminder (:use :cl))
+(in-package :me.bsima.journal-reminder)
+
+(defparameter *journal-dir* "/home/ben/Dropbox/org/journal")
+
+(defun today-string ()
+ (multiple-value-bind (second minute hour day month year)
+ (get-decoded-time)
+ (declare (ignore second minute hour))
+ (format nil "~d~d~d" year month day)))
+
+(defun mk-journal-file (journal-dir date)
+ (format nil "~a/~a" journal-dir date))
+
+(defun journaled-today? ()
+ (let ((journal-file (mk-journal-file *journal-dir* (today-string))))
+ (if (probe-file journal-file)
+ T
+ nil)))
+
+(defun journal-reminder (&rest argv)
+ (declare (ignorable argv))
+ ;; If journal-dir argumen is supplied, use it
+ (let ((*journal-dir* (or (first argv) *journal-dir*)))
+ (if (journaled-today?)
+ nil
+ (format t "You still need to journal!~%"))))
+
+(defun main (&rest argv)
+ (apply #'journal-reminder argv))