From d2bc79bfd01fededb37aa5780bd970e92639cb45 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Fri, 18 Mar 2022 16:11:06 +0530 Subject: bin: Abstract out the loading of the configuration file. * bin/tissue (load-config): New function. (tissue-web): Use load-config. --- bin/tissue | 14 ++++++++++---- 1 file 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 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) -- cgit v1.2.3