summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-10-17 22:51:38 +0200
committerLudovic Courtès <ludo@gnu.org>2016-10-17 23:59:02 +0200
commit31c2fd1e01d5f95cd1fb873c44f5fa4ac1164e69 (patch)
tree46a2964ed39d4f0997ee416f20a077d8c1c1ec58
parent5cf01aa53f67a226198cba63fd952a9c9e5aa842 (diff)
downloadguix-31c2fd1e01d5f95cd1fb873c44f5fa4ac1164e69.tar.gz
guix build: Factorize transformation option parsing.
* guix/scripts/build.scm (%transformation-options): Introduce 'parser'
procedure and use it.
-rw-r--r--guix/scripts/build.scm19
1 files changed, 9 insertions, 10 deletions
diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index 644993101e..bd97d56dce 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -219,16 +219,15 @@ called \"guile\" must be replaced with a dependency on a version 2.1 of
 
 (define %transformation-options
   ;; The command-line interface to the above transformations.
-  (list (option '("with-source") #t #f
-                (lambda (opt name arg result . rest)
-                  (apply values
-                         (cons (alist-cons 'with-source arg result)
-                               rest))))
-        (option '("with-input") #t #f
-                (lambda (opt name arg result . rest)
-                  (apply values
-                         (cons (alist-cons 'with-input arg result)
-                               rest))))))
+  (let ((parser (lambda (symbol)
+                  (lambda (opt name arg result . rest)
+                    (apply values
+                           (alist-cons symbol arg result)
+                           rest)))))
+    (list (option '("with-source") #t #f
+                  (parser 'with-source))
+          (option '("with-input") #t #f
+                  (parser 'with-input)))))
 
 (define (show-transformation-options-help)
   (display (_ "