summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2022-07-05 00:25:13 +0530
committerArun Isaac2022-07-05 00:59:20 +0530
commit2d5e11dece7476ba9b777e19c717314f26dd031d (patch)
treef9c5e78b611f82d8ae6a513d2082374dd28dd13f
parent2031aabfa1897f867fa26ce8edf20758d755ea71 (diff)
downloadtissue-2d5e11dece7476ba9b777e19c717314f26dd031d.tar.gz
tissue-2d5e11dece7476ba9b777e19c717314f26dd031d.tar.lz
tissue-2d5e11dece7476ba9b777e19c717314f26dd031d.zip
bin: Pass configuration file to `tissue run-web' as an option.
* bin/tissue (tissue-run-web): Accept configuration file as a command-line option. (unrecognized-argument): New function.
-rwxr-xr-xbin/tissue21
1 files changed, 14 insertions, 7 deletions
diff --git a/bin/tissue b/bin/tissue
index 789cdb8..28aa68f 100755
--- a/bin/tissue
+++ b/bin/tissue
@@ -66,6 +66,9 @@ exec guile --no-auto-compile -s "$0" "$@"
(define (invalid-option opt name arg loads)
(error "Invalid option" name))
+(define (unrecognized-argument arg loads)
+ (error "Unrecognized argument" arg))
+
(define (command-line-program)
"Return the name, that is arg0, of the command-line program invoked
to run tissue."
@@ -214,10 +217,11 @@ Export the repository as a website to OUTPUT-DIRECTORY.
(define tissue-run-web
(match-lambda*
(("--help")
- (format #t "Usage: ~a run-web CONFIG-FILE
+ (format #t "Usage: ~a run-web [OPTIONS]
Run a web search service reading configuration from CONFIG-FILE.
- --listen-repl=P run REPL server listening on port or path P
+ --listen-repl=P run REPL server listening on port or path P
+ -C, --config=CONFIG-FILE read configuration parameters from CONFIG-FILE
"
(command-line-program)))
(args
@@ -228,12 +232,15 @@ Run a web search service reading configuration from CONFIG-FILE.
(acons 'listen-repl
(or (string->number arg)
arg)
- result))))
+ result)))
+ (option '(#\C "config")
+ #t #f
+ (lambda (opt name config-file result)
+ (append (call-with-input-file config-file
+ read)
+ result))))
invalid-option
- (lambda (config-file result)
- (append (call-with-input-file config-file
- read)
- result))
+ unrecognized-argument
;; Default listen
'((listen . "127.0.0.1:8080")))))
(let ((listen-repl (assq-ref args 'listen-repl)))