From 6c37a4c00cd420e50d0cd2ad088268bcbb3d9155 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Wed, 1 Apr 2020 21:01:17 +0200 Subject: Update remaining code to use new config scheme. --- module/entry-points/benchmark.scm | 5 ++--- module/entry-points/html.scm | 9 +++------ module/entry-points/ical.scm | 5 ++--- module/entry-points/server.scm | 28 +++++++++++++--------------- module/entry-points/terminal.scm | 6 ++---- 5 files changed, 22 insertions(+), 31 deletions(-) (limited to 'module/entry-points') diff --git a/module/entry-points/benchmark.scm b/module/entry-points/benchmark.scm index a21b4630..4843a80a 100644 --- a/module/entry-points/benchmark.scm +++ b/module/entry-points/benchmark.scm @@ -4,7 +4,6 @@ :use-module (ice-9 getopt-long) :use-module (util) :use-module (vcomponent) - :use-module (util config all) ) @@ -14,5 +13,5 @@ (define (main args) (define opts (getopt-long args opt-spec)) - (load-calendars* calendar-files: (cond [(option-ref opts 'file #f) => list] - [else (calendar-files)]))) + (cond [(option-ref opts 'file #f) => (compose load-calendars* list)] + [else (load-calendars)])) diff --git a/module/entry-points/html.scm b/module/entry-points/html.scm index bacc8038..34ecc2dd 100644 --- a/module/entry-points/html.scm +++ b/module/entry-points/html.scm @@ -7,8 +7,6 @@ :use-module (datetime) :use-module (datetime util) :use-module (ice-9 getopt-long) - - :use-module (util config all) ) @@ -32,9 +30,8 @@ (define style (string->symbol (option-ref opts 'style "wide"))) (define-values (calendars events) - (load-calendars - calendar-files: (cond [(option-ref opts 'file #f) => list] - [else (calendar-files)]) )) + (cond [(option-ref opts 'file #f) => (compose load-calendars list)] + [else (load-calendars)])) (report-time! "Calendars loaded") @@ -49,7 +46,7 @@ ;; be a good idea to instead center it on the current week, meaning ;; that the active row is always in the center (html-chunked-main count calendars events - (previous-week-start start (week-start)) + (previous-week-start start (get-config 'week-start)) (date day: 7))] [(table) (html-table-main count calendars events start)] diff --git a/module/entry-points/ical.scm b/module/entry-points/ical.scm index e2ee7dcf..f2f4e0b5 100644 --- a/module/entry-points/ical.scm +++ b/module/entry-points/ical.scm @@ -3,7 +3,6 @@ :use-module (util) :use-module (output ical) :use-module ((vcomponent) :select (load-calendars*)) - :use-module ((util config all) :select (calendar-files)) :use-module (ice-9 getopt-long) :use-module (datetime) :use-module (datetime util) @@ -26,8 +25,8 @@ ;; TODO this contains repeated events multiple times (define-values (calendars regular repeating) - (load-calendars* calendar-files: (cond [(option-ref opts 'file #f) => list] - [else (calendar-files)]) )) + (cond [(option-ref opts 'file #f) => (compose load-calendars* list)] + [else (load-calendars*)])) (ical-main calendars regular repeating start end) ) diff --git a/module/entry-points/server.scm b/module/entry-points/server.scm index e3ce168a..25b86735 100644 --- a/module/entry-points/server.scm +++ b/module/entry-points/server.scm @@ -2,7 +2,6 @@ :export (main) :use-module (util) :use-module (vcomponent) - :use-module (util config all) ) (use-modules* (web (server request response uri)) @@ -122,9 +121,8 @@ [else AF_INET6])) (define-values (c e) - (load-calendars - calendar-files: (cond [(option-ref opts 'file #f) => list] - [else (calendar-files)]) )) + (cond [(option-ref opts 'file #f) => (compose load-calendars list)] + [else (load-calendars)])) @@ -134,19 +132,19 @@ ;; placed after load-calendars to keep Guile 2.2 compability. (set! addr (if addr addr - (if (eqv? family AF_INET6) - "::" "0.0.0.0"))) + (if (eqv? family AF_INET6) + "::" "0.0.0.0"))) ;; NOTE The default make-default-socket is broken for IPv6. ;; A patch has been submitted to the mailing list. 2020-03-31 (module-set! - (resolve-module '(web server http)) - 'make-default-socket - (lambda (family addr port) - (let ((sock (socket family SOCK_STREAM 0))) - (setsockopt sock SOL_SOCKET SO_REUSEADDR 1) - (bind sock family addr port) - sock))) + (resolve-module '(web server http)) + 'make-default-socket + (lambda (family addr port) + (let ((sock (socket family SOCK_STREAM 0))) + (setsockopt sock SOL_SOCKET SO_REUSEADDR 1) + (bind sock family addr port) + sock))) ;; TODO possibly test inet-pton here on address? @@ -158,6 +156,6 @@ (run-server (make-make-routes c e) 'http `(family: ,family - port: ,port - host: ,addr) + port: ,port + host: ,addr) 0)) diff --git a/module/entry-points/terminal.scm b/module/entry-points/terminal.scm index 0f2a85f0..9f486d90 100644 --- a/module/entry-points/terminal.scm +++ b/module/entry-points/terminal.scm @@ -5,7 +5,6 @@ :use-module (ice-9 getopt-long) :use-module (datetime) :use-module (datetime util) - :use-module (util config all) :use-module (vulgar) ) @@ -16,9 +15,8 @@ (define (main args) (define opts (getopt-long args options)) (define-values (calendars events) - (load-calendars - calendar-files: (cond [(option-ref opts 'file #f) => list] - [else (calendar-files)]) )) + (cond [(option-ref opts 'file #f) => (compose load-calendars list)] + [else (load-calendars)])) (let ((date (or (and=> (option-ref opts 'date #f) parse-freeform-date) (current-date)))) -- cgit v1.2.3