summaryrefslogtreecommitdiffstats
path: root/hn/g
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2019-06-18 19:51:28 -0400
committerrsiddharth <s@ricketyspace.net>2019-06-18 19:51:28 -0400
commitb085da5446b58254a82ee457568cf6929f278cfd (patch)
treecb9632b85b737999d295e58b8c7f98a4f9422553 /hn/g
parent315d13b733b3f41191279a6e897e4bbe89896004 (diff)
hn/g: Add athings:index.
* hn/g (athings:index): New function.
Diffstat (limited to 'hn/g')
-rwxr-xr-xhn/g7
1 files changed, 7 insertions, 0 deletions
diff --git a/hn/g b/hn/g
index d8855aa..76a262d 100755
--- a/hn/g
+++ b/hn/g
@@ -84,3 +84,10 @@
(cond ((file-exists? f) (call-with-input-file f (λ (in) (read-json in))))
(else '()))))
+(define (athings:index slug)
+ (let ((f (build-path (athings:data-dir) "list"))
+ (l (athings:list)))
+ (unless (member slug l)
+ (call-with-output-file f (λ (out) (write-json (cons slug l) out))
+ #:exists 'truncate))))
+