summaryrefslogtreecommitdiff
path: root/journal-reminder
blob: 82e188fa586cd908d8c5f93e1b3e34568bbd55c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env racket
#|-*- mode:scheme *-*|#
#lang racket/base

(require (only-in racket/cmdline command-line))

(define +journal-dir+ "/home/ben/Dropbox/org/journal")

(define (pad-zero n) (if (< n 10) (format "0~a" n) n))

(define (today)
  (let* [(date  (seconds->date (current-seconds)))
         (year  (date-year date))
         (month (date-month date))
         (day   (date-day date))]
    (format "~a~a~a"
            (date-year date)
            (pad-zero month)
            (pad-zero day))))

(define (journal-file d)
  (format "~a/~a" +journal-dir+ d))

(define (journaled-today? d)
  (if (file-exists? (journal-file d)) #t #f))

(if (not (journaled-today? (today)))
    "You still need to journal!"
    null)