From 0da14caae5d3cf9533a2e82acb60267b9faee03f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 17 Aug 2020 20:12:48 +0200 Subject: Fix global version var. --- module/calp.scm | 4 ++++ module/calp/main.scm | 9 ++++++++- module/global.scm | 5 ----- module/vcomponent/ical/output.scm | 8 ++++++-- 4 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 module/calp.scm delete mode 100644 module/global.scm (limited to 'module') diff --git a/module/calp.scm b/module/calp.scm new file mode 100644 index 00000000..43fa4707 --- /dev/null +++ b/module/calp.scm @@ -0,0 +1,4 @@ +(define-module (calp)) + +;; Update me on new release +(define-public version "0.5") diff --git a/module/calp/main.scm b/module/calp/main.scm index 2e08fd0f..ee49c250 100644 --- a/module/calp/main.scm +++ b/module/calp/main.scm @@ -23,7 +23,7 @@ (define options - '((statprof (value display-style) + `((statprof (value display-style) (description "Run the program within Guile's built in statical " "profiler. Display style is one of " (b "flat") " or " (b "tree") ".")) @@ -53,6 +53,9 @@ "Can " (i "not") " be given with an equal after --option." (br) "Can be given multiple times.")) + (version (single-char #\v) + (description "Display version, which is " ,(@ (calp) version) " btw.")) + (update-zoneinfo) (help (single-char #\h) @@ -152,6 +155,10 @@ (throw 'return) ) + (when (option-ref opts 'version #f) + (format #t "Calp version ~a~%" (@ (calp) version)) + (throw 'return)) + (when (option-ref opts 'update-zoneinfo #f) (let ((pipe (let-env ((PREFIX (get-config 'path-prefix))) diff --git a/module/global.scm b/module/global.scm deleted file mode 100644 index a38a5d21..00000000 --- a/module/global.scm +++ /dev/null @@ -1,5 +0,0 @@ -(define-module (global)) - -(define-once *prodid* "-//hugo//Calparse 0.9//EN") -(export *prodid*) - diff --git a/module/vcomponent/ical/output.scm b/module/vcomponent/ical/output.scm index ec2458ba..75e579b8 100644 --- a/module/vcomponent/ical/output.scm +++ b/module/vcomponent/ical/output.scm @@ -18,6 +18,10 @@ :use-module ((datetime instance) :select (zoneinfo)) ) +(define (prodid) + (format #f "-//hugo//calp ~a//EN" + (@ (calp) version))) + ;; Format value depending on key type. ;; Should NOT emit the key. @@ -163,7 +167,7 @@ (define (write-event-to-file event calendar-path) (define cal (make-vcomponent 'VCALENDAR)) - (set! (prop cal 'PRODID) (@ (global) *prodid*) + (set! (prop cal 'PRODID) (prodid) (prop cal 'VERSION) "2.0" (prop cal 'CALSCALE) "GREGORIAN") @@ -191,7 +195,7 @@ PRODID:~a\r VERSION:2.0\r CALSCALE:GREGORIAN\r -" (@ (global) *prodid*) +" (prodid) )) -- cgit v1.2.3