aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/nar-herder.in24
1 files changed, 21 insertions, 3 deletions
diff --git a/scripts/nar-herder.in b/scripts/nar-herder.in
index 1cc5a67..0f4f7f2 100644
--- a/scripts/nar-herder.in
+++ b/scripts/nar-herder.in
@@ -77,6 +77,20 @@
`((database . ,(string-append (getcwd) "/nar_herder.db"))
(database-dump . ,(string-append (getcwd) "/nar_herder_dump.db"))))
+(define %import-options
+ (list (option '("tag") #t #f
+ (lambda (opt name arg result)
+ (alist-cons 'tags
+ (cons (match (string-split arg #\=)
+ ((key value)
+ (cons key value)))
+ (or (assq-ref result 'tags)
+ '()))
+ (alist-delete 'tags result))))))
+
+(define %import-options-defaults
+ '())
+
(define %server-options
(list (option '("port") #t #f
(lambda (opt name arg result)
@@ -172,8 +186,10 @@
(match (cdr (program-arguments))
(("import" rest ...)
- (let* ((opts (parse-options %base-options
- %base-option-defaults
+ (let* ((opts (parse-options (append %base-options
+ %import-options)
+ (append %base-option-defaults
+ %import-options-defaults)
rest))
(database (setup-database
(assq-ref opts 'database))))
@@ -212,7 +228,9 @@
(lambda (port)
;; Set url to a dummy value as this doesn't
;; matter
- (read-narinfo port "https://narherderdummyvalue"))))
+ (read-narinfo port "https://narherderdummyvalue")))
+ #:tags (or (assq-ref opts 'tags)
+ '()))
(report))
narinfos))))))