summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2022-07-05 00:57:41 +0530
committerArun Isaac2022-07-05 00:59:20 +0530
commite1b0cee919d9439ce47ba9bd8d0ec9c06e0e1c50 (patch)
treeb146daf71d208e41e73a3e1baff11b5cbe387556
parentf7bf3f3e561d942f0b6720e8f23ec94b97330371 (diff)
downloadtissue-e1b0cee919d9439ce47ba9bd8d0ec9c06e0e1c50.tar.gz
tissue-e1b0cee919d9439ce47ba9bd8d0ec9c06e0e1c50.tar.lz
tissue-e1b0cee919d9439ce47ba9bd8d0ec9c06e0e1c50.zip
bin: Centralize `tissue pull' and `tissue run-web' configuration.
* bin/tissue (default-configuration): New function. (tissue-pull, tissue-run-web): Use default-configuration.
-rwxr-xr-xbin/tissue21
1 files changed, 12 insertions, 9 deletions
diff --git a/bin/tissue b/bin/tissue
index 36e9e3b..006a94a 100755
--- a/bin/tissue
+++ b/bin/tissue
@@ -214,6 +214,15 @@ Export the repository as a website to OUTPUT-DIRECTORY.
(string->number
(substring listen (1+ (string-index-right listen #\:))))))))
+(define (default-configuration)
+ "Return the default configuration options for the `tissue pull' and
+`tissue run-web' subcommands."
+ `((listen . "127.0.0.1:8080")
+ (state-directory . "/var/lib/tissue")
+ ;; Assume current repository as default.
+ (hosts ("localhost"
+ (upstream-repository . ,(git-top-level))))))
+
(define tissue-run-web
(match-lambda*
(("--help")
@@ -241,8 +250,7 @@ Run a web search service reading configuration from CONFIG-FILE.
result))))
invalid-option
unrecognized-argument
- ;; Default listen
- '((listen . "127.0.0.1:8080")))))
+ (default-configuration))))
(let ((listen-repl (assq-ref args 'listen-repl)))
(when listen-repl
(spawn-server (cond
@@ -268,10 +276,7 @@ Run a web search service reading configuration from CONFIG-FILE.
(acons 'css
(tissue-configuration-web-css (load-config))
parameters)))))
- (or (assq-ref args 'hosts)
- ;; Assume current directory as default.
- `(("localhost"
- (indexed-repository . ,(getcwd))))))
+ (assq-ref args 'hosts))
(assq-ref args 'state-directory))))))
;; This is a noop, since the index is built on any tissue command. It
@@ -432,9 +437,7 @@ Pull latest from upstream repositories.
invalid-option
(lambda (host result)
(acons 'host host result))
- ;; Default configuration parameters
- '((state-directory . "/var/lib/tissue")
- (hosts . ())))))
+ (default-configuration))))
(let ((state-directory (assq-ref args 'state-directory)))
;; Error out if state directory does not exist.
(unless (file-exists? state-directory)