aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-08-17 20:12:48 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-08-17 20:16:23 +0200
commit0da14caae5d3cf9533a2e82acb60267b9faee03f (patch)
tree05ddab0f6474e4901e14971ab67b747b807f7aa0
parentRemove (@ (global) basedir). (diff)
downloadcalp-0da14caae5d3cf9533a2e82acb60267b9faee03f.tar.gz
calp-0da14caae5d3cf9533a2e82acb60267b9faee03f.tar.xz
Fix global version var.
-rw-r--r--module/calp.scm4
-rw-r--r--module/calp/main.scm9
-rw-r--r--module/global.scm5
-rw-r--r--module/vcomponent/ical/output.scm8
4 files changed, 18 insertions, 8 deletions
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)
))