forked from mario-goulart/salmonella
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsalmonella-log-viewer.scm
58 lines (48 loc) · 1.43 KB
/
salmonella-log-viewer.scm
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
(use salmonella-log-parser)
(include "salmonella-version.scm")
(define (concat l)
(string-intersperse (map ->string l) ""))
(define (h1 . text)
(conc "###\n### " (concat text) "\n###\n"))
(define (h2 . text)
(conc "=== " (concat text)))
(define (view-log log-file)
(let* ((log (read-log-file log-file))
(eggs (sort-eggs (log-eggs log))))
(for-each
(lambda (egg)
;; Heading
(print (h1 egg))
;; Installation
(print (h2 egg " installation: ")
(case (install-status egg log)
((0) "[OK]")
(else "[FAIL]"))
"\n")
(print (install-message egg log))
;; Tests
(print (h2 egg " test: ")
(case (test-status egg log)
((0 #t) "[OK]")
((-1) "[ -- ]")
(else "[FAIL]"))
"\n")
(print (test-message egg log)))
eggs)
;; env info
(print (h1 "Environment information"))
(print (salmonella-info log))
))
(define (usage #!optional exit-code)
(let ((this (pathname-strip-directory (program-name))))
(print this " <salmonella log file>"))
(when exit-code (exit exit-code)))
(let ((args (command-line-arguments)))
(when (null? args) (usage 1))
(when (or (member "-h" args)
(member "--help" args))
(usage 0))
(when (member "--version" args)
(print salmonella-version)
(exit 0))
(view-log (car args)))