summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
authorArun Isaac2022-03-18 16:11:06 +0530
committerArun Isaac2022-03-18 16:24:31 +0530
commitd2bc79bfd01fededb37aa5780bd970e92639cb45 (patch)
tree7a586ab2f961121999c4eb050ca1c626f2803360 /bin
parent40b6dccc645d5f51cca1a6235db45302f13fdfac (diff)
downloadtissue-d2bc79bfd01fededb37aa5780bd970e92639cb45.tar.gz
tissue-d2bc79bfd01fededb37aa5780bd970e92639cb45.tar.lz
tissue-d2bc79bfd01fededb37aa5780bd970e92639cb45.zip
bin: Abstract out the loading of the configuration file.
* bin/tissue (load-config): New function.
(tissue-web): Use load-config.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/tissue14
1 files changed, 10 insertions, 4 deletions
diff --git a/bin/tissue b/bin/tissue
index 1293891..93612e3 100755
--- a/bin/tissue
+++ b/bin/tissue
@@ -349,6 +349,15 @@ Show the text of issue #ISSUE-NUMBER.
                 port)))
            (raise (issue-file-not-found-error issue-file)))))))
 
+(define load-config
+  (memoize-thunk
+   (lambda ()
+     "Load configuration and return <tissue-configuration> object."
+     (load (string-append (call-with-input-pipe
+                           get-line
+                           "git" "rev-parse" "--show-toplevel")
+                          "/tissue.scm")))))
+
 (define tissue-web
   (match-lambda*
     (("--help")
@@ -358,10 +367,7 @@ Export the repository as a website to OUTPUT-DIRECTORY.
 "
              (command-line-program)))
     ((output-directory)
-     (let ((config (load (string-append (call-with-input-pipe
-                                         get-line
-                                         "git" "rev-parse" "--show-toplevel")
-                                        "/tissue.scm"))))
+     (let ((config (load-config)))
        (build-website output-directory
                       #:title (tissue-configuration-project config)
                       #:css (tissue-configuration-web-css config)