blob: 6d9c3290fbe102793525124530c03bf6ce702fe0 (
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#!/usr/bin/guile \
-s
!#
;;; Commentary:
;;; Script for finding all top level `config' forms. Run this from the
;;; project root.
;;; Code:
(add-to-load-path "module")
(use-modules
(util)
(ice-9 ftw)
(ice-9 match)
(srfi srfi-1)
)
(define (read-multiple)
(let loop ((done '()))
(let ((sexp (read)))
(if (eof-object? sexp)
(reverse done)
(loop (cons sexp done))))))
(define remove-stat
(match-lambda
((name state) name)
((name stat children ...)
(cons name (map remove-stat children)))))
(define (f tree)
(let loop ((rem tree) (path '()))
(cond [(string? rem)
(string-join (reverse (cons rem path)) "/" 'infix)]
[(null? rem)
'()]
[else
(map (lambda (branch)
(loop branch (cons (car rem) path)))
(cdr rem))])))
((@ (ice-9 pretty-print) pretty-print)
(filter
(lambda (form)
(and (list? form) (not (null? form))
(eq? 'define-config (car form))))
(concatenate
(map (lambda (filename) (with-input-from-file filename read-multiple))
(flatten (f (remove-stat (file-system-tree "module"))))))))
;; expected result =>
#;
((config debug)
(config edit-mode)
(config summary-filter)
(config description-filter)
(config
tz-dir
"Directory in which zoneinfo files can be found")
(config
tz-list
"List of default zoneinfo files to be parsed")
(config default-week-start "First day of week")
(config
calendar-files
"Which files to parse. Takes a list of paths or a single string which will be globbed."))
|