Get version from info.rkt
authorSiraaj Khandkar <siraaj@khandkar.net>
Thu, 19 Nov 2020 00:59:12 +0000 (19:59 -0500)
committerSiraaj Khandkar <siraaj@khandkar.net>
Thu, 19 Nov 2020 00:59:12 +0000 (19:59 -0500)
info.rkt
tt.rkt

index afe2865..a9c77f7 100644 (file)
--- a/info.rkt
+++ b/info.rkt
@@ -6,7 +6,7 @@
 (define pkg-desc
   "twtxt client")
 (define version
-  "0.3.5")
+  "0.3.6")
 (define pkg-authors
   '("Siraaj Khandkar <siraaj@khandkar.net>"))
 (define deps
diff --git a/tt.rkt b/tt.rkt
index 421af36..c63f35d 100644 (file)
--- a/tt.rkt
+++ b/tt.rkt
     "https://raw.githubusercontent.com/mdom/we-are-twtxt/master/we-are-twtxt.txt")
   (str->feeds (uri-fetch uri)))
 
-(define user-agent
+(define (user-agent prog-name prog-version)
   (let*
-    ([prog-name      "tt"]
-     [prog-version   "0.3.5"]
-     [prog-uri       "https://github.com/xandkar/tt"]
+    ([prog-uri       "https://github.com/xandkar/tt"]
      [user-feed-file (expand-user-path "~/twtxt-me.txt")]
      [user
        (if (file-exists? user-feed-file)
     (format "~a/~a (~a)" prog-name prog-version user)))
 
 (module+ main
+  (require setup/getinfo)
   (define (setup-logging)
     (define logger (make-logger #f #f 'debug #f))
     (define log-chan (make-log-receiver logger 'debug))
 
   (setup-logging)
   (current-http-response-auto #f)
-  (current-http-user-agent user-agent)
+  (let* ([prog-name    "tt"]
+         [prog-version ((get-info (list prog-name)) 'version)]
+         [user-agent   (user-agent prog-name prog-version)])
+    (current-http-user-agent user-agent))
   (date-display-format 'rfc2822)
 
   (define args (current-command-line-arguments))
This page took 0.038014 seconds and 4 git commands to generate.