guix build: Factorize transformation option parsing.

* guix/scripts/build.scm (%transformation-options): Introduce 'parser'
procedure and use it.
This commit is contained in:
Ludovic Courtès 2016-10-17 22:51:38 +02:00
parent 5cf01aa53f
commit 31c2fd1e01
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 9 additions and 10 deletions

View File

@ -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 (_ "