ARGUMENT-HANDLER is called for non-option arguments, like the 'operand-proc'
parameter of 'args-fold'."
- (define (parse-options-from args)
+ (define (parse-options-from args seeds)
;; Actual parsing takes place here.
(apply args-fold* args options
(lambda (opt name arg . rest)
argument-handler
seeds))
- (append (parse-options-from args)
- (parse-options-from (environment-build-options))))
+ (call-with-values
+ (lambda ()
+ (parse-options-from (environment-build-options) seeds))
+ (lambda seeds
+ ;; ARGS take precedence over what the environment variable specifies.
+ (parse-options-from args seeds))))
(define (show-guix-usage)
(format (current-error-port)
%standard-build-options
(list '()))))
+(test-equal "parse-command-line and --no options"
+ '((argument . "foo")
+ (substitutes? . #f)) ;takes precedence
+
+ (with-environment-variable "GUIX_BUILD_OPTIONS" "--no-substitutes"
+ (parse-command-line '("foo")
+ %standard-build-options
+ (list '((substitutes? . #t))))))
+
(test-assert "fill-paragraph"
(every (lambda (column)
(every (lambda (width)