M guix/scripts.scm => guix/scripts.scm +9 -5
@@ 67,11 67,13 @@ reporting."
(define* (parse-command-line args options seeds
#:key
+ (build-options? #t)
(argument-handler %default-argument-handler))
- "Parse the command-line arguments ARGS as well as arguments passed via the
-'GUIX_BUILD_OPTIONS' environment variable according to OPTIONS (a list of
-SRFI-37 options) and return the result, seeded by SEEDS.
-Command-line options take precedence those passed via 'GUIX_BUILD_OPTIONS'.
+ "Parse the command-line arguments ARGS according to OPTIONS (a list of
+SRFI-37 options) and return the result, seeded by SEEDS. When BUILD-OPTIONS?
+is true, also pass arguments passed via the 'GUIX_BUILD_OPTIONS' environment
+variable. Command-line options take precedence those passed via
+'GUIX_BUILD_OPTIONS'.
ARGUMENT-HANDLER is called for non-option arguments, like the 'operand-proc'
parameter of 'args-fold'."
@@ 85,7 87,9 @@ parameter of 'args-fold'."
(call-with-values
(lambda ()
- (parse-options-from (environment-build-options) seeds))
+ (if build-options?
+ (parse-options-from (environment-build-options) seeds)
+ (apply values seeds)))
(lambda seeds
;; ARGS take precedence over what the environment variable specifies.
(parse-options-from args seeds))))
M guix/scripts/challenge.scm => guix/scripts/challenge.scm +2 -6
@@ 278,12 278,8 @@ Challenge the substitutes for PACKAGE... provided by one or more servers.\n"))
(define (guix-challenge . args)
(with-error-handling
- (let* ((opts (args-fold* args %options
- (lambda (opt name arg . rest)
- (leave (G_ "~A: unrecognized option~%") name))
- (lambda (arg result)
- (alist-cons 'argument arg result))
- %default-options))
+ (let* ((opts (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(files (filter-map (match-lambda
(('argument . file) file)
(_ #f))
M guix/scripts/gc.scm => guix/scripts/gc.scm +2 -6
@@ 159,12 159,8 @@ Invoke the garbage collector.\n"))
(define (guix-gc . args)
(define (parse-options)
;; Return the alist of option values.
- (args-fold* args %options
- (lambda (opt name arg result)
- (leave (G_ "~A: unrecognized option~%") name))
- (lambda (arg result)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(define (symlink-target file)
(let ((s (false-if-exception (lstat file))))
M guix/scripts/graph.scm => guix/scripts/graph.scm +3 -6
@@ 447,12 447,9 @@ Emit a Graphviz (dot) representation of the dependencies of PACKAGE...\n"))
(define (guix-graph . args)
(with-error-handling
- (let* ((opts (args-fold* args %options
- (lambda (opt name arg . rest)
- (leave (G_ "~A: unrecognized option~%") name))
- (lambda (arg result)
- (alist-cons 'argument arg result))
- %default-options))
+ (let* ((opts (parse-command-line args %options
+ (list %default-options)
+ #:build-options? #f))
(backend (assoc-ref opts 'backend))
(type (assoc-ref opts 'node-type))
(items (filter-map (match-lambda
M guix/scripts/hash.scm => guix/scripts/hash.scm +2 -7
@@ 104,13 104,8 @@ and 'hexadecimal' can be used as well).\n"))
(define (guix-hash . args)
(define (parse-options)
;; Return the alist of option values.
- (args-fold* args %options
- (lambda (opt name arg result)
- (leave (G_ "unrecognized option: ~a~%")
- name))
- (lambda (arg result)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(define (vcs-file? file stat)
(case (stat:type stat)
M guix/scripts/lint.scm => guix/scripts/lint.scm +2 -6
@@ 1123,12 1123,8 @@ run the checkers on all packages.\n"))
(define (guix-lint . args)
(define (parse-options)
;; Return the alist of option values.
- (args-fold* args %options
- (lambda (opt name arg result)
- (leave (G_ "~A: unrecognized option~%") name))
- (lambda (arg result)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(let* ((opts (parse-options))
(args (filter-map (match-lambda
M guix/scripts/refresh.scm => guix/scripts/refresh.scm +2 -6
@@ 338,12 338,8 @@ dependent packages are rebuilt: ~{~a~^ ~}~%"
(define (guix-refresh . args)
(define (parse-options)
;; Return the alist of option values.
- (args-fold* args %options
- (lambda (opt name arg result)
- (leave (G_ "~A: unrecognized option~%") name))
- (lambda (arg result)
- (alist-cons 'argument arg result))
- %default-options))
+ (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(define (options->updaters opts)
;; Return the list of updaters to use.
M guix/scripts/size.scm => guix/scripts/size.scm +2 -6
@@ 291,12 291,8 @@ Report the size of PACKAGE and its dependencies.\n"))
(define (guix-size . args)
(with-error-handling
- (let* ((opts (args-fold* args %options
- (lambda (opt name arg . rest)
- (leave (G_ "~A: unrecognized option~%") name))
- (lambda (arg result)
- (alist-cons 'argument arg result))
- %default-options))
+ (let* ((opts (parse-command-line args %options (list %default-options)
+ #:build-options? #f))
(files (filter-map (match-lambda
(('argument . file) file)
(_ #f))
M guix/scripts/weather.scm => guix/scripts/weather.scm +3 -6
@@ 204,12 204,9 @@ Report the availability of substitutes.\n"))
(define (guix-weather . args)
(with-error-handling
- (let* ((opts (args-fold* args %options
- (lambda (opt name arg . rest)
- (leave (G_ "~A: unrecognized option~%") name))
- (lambda (arg result)
- (alist-cons 'argument arg result))
- %default-options))
+ (let* ((opts (parse-command-line args %options
+ (list %default-options)
+ #:build-options? #f))
(urls (assoc-ref opts 'substitute-urls))
(systems (match (filter-map (match-lambda
(('system . system) system)