Removed imports.
[microbotany.git] / directory.gmi
1 # Garden Directory
2
3 ```
4 ,(eval (begin
5          (for-each eval (with-input-from-file "garden.scm" read-list))
6          (define (pad-string o max-len)
7            (let* ((s (->string o))
8                   (n (string-length s)))
9              (if (> n max-len)
10                  (string-take s max-len)
11                  (conc s (make-string (- max-len n) #\space)))))
12          (define (print-rule n)
13            (print (make-string n #\-)))
14          (let* ((headers '("Owner" "Created" "Plant Stage"))
15                 (colwidths '(20 30 15))
16                 (total-width (apply + colwidths)))
17            (apply print (map pad-string headers colwidths))
18            (print-rule total-width)
19            (for-each
20             (lambda (garden-file)
21               (let ((g (with-input-from-file garden-file read)))
22                 (update-garden! g)
23                 (with-output-to-file garden-file (lambda () (write g)))
24                 (let ((fields (list (garden-prop 'user g)
25                                     (seconds->string (garden-prop 'created g))
26                                     (garden-stage g))))
27                   (apply print (map pad-string fields colwidths)))))
28             (glob "accounts/*"))
29            (print-rule total-width))))
30 ```
31
32 => ./ Return to the μBotany start page