From ea29b985530a94daa18250ab4532d0690992f597 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 4 May 2020 18:30:04 +0200 Subject: Add --help to ical. --- module/entry-points/ical.scm | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/module/entry-points/ical.scm b/module/entry-points/ical.scm index dc060ec6..7e780d89 100644 --- a/module/entry-points/ical.scm +++ b/module/entry-points/ical.scm @@ -1,6 +1,7 @@ (define-module (entry-points ical) :export (main) :use-module (util) + :use-module (util options) :use-module (output ical) :use-module ((vcomponent) :select (load-calendars*)) :use-module (ice-9 getopt-long) @@ -10,11 +11,13 @@ (define opt-spec '((from (value #t) (single-char #\F)) - (to (value #t) (single-char #\T)) - (file (value #t) (single-char #\f)))) + (to (value #t) (single-char #\T) + (description "Returns all elements between these two dates.")) + (help (single-char #\h) + (description "Print this help.")))) (define (main args) - (define opts (getopt-long args opt-spec)) + (define opts (getopt-long args (getopt-opt opt-spec))) (define start (cond [(option-ref opts 'from #f) => parse-freeform-date] [else (start-of-month (current-date))])) @@ -22,4 +25,9 @@ ;; [else (normalize-date* (set (month start) = (+ 1)))] [(date+ start (date month: 1))] )) + + (when (option-ref opts 'help #f) + (print-arg-help opt-spec) + (throw 'return)) + (ical-main start end)) -- cgit v1.2.3