aboutsummaryrefslogtreecommitdiff
path: root/module/calp/entry-points/terminal.scm
blob: 9a1b8b0044d8f26c79abdc808ac364a9418c9582 (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
(define-module (calp entry-points terminal)
  :export (main)
  :use-module (calp terminal)
  :use-module (vcomponent)
  :use-module (ice-9 getopt-long)
  :use-module (datetime)
  :use-module (vulgar)
  :use-module (hnh util options)
  :use-module (calp translation)
  )

(define options
  `((date (value #t) (single-char #\d)
          (description ,(G_ "Which date to start on.")))
    (help (single-char #\t) (description ,(G_ "Print this help.")))
    ))

(define (main args)
  (define opts (getopt-long args (getopt-opt options)))

  (when (option-ref opts 'help #f)
    (print-arg-help options)
    (throw 'return))

  (let ((date (or (and=> (option-ref opts 'date #f) parse-freeform-date)
                  (current-date))))
    (with-vulgar
     (lambda () (main-loop date))))
)