lint: Fix argument parsing when several packages are specified.
* guix/scripts/lint.scm (%options) <--checkers>: Remove 'arg-handler' parameter, and return a single value. (guix-lint)[parse-options]: Remove 'arg-handler' parameter from handlers. Remove second seed to 'args-fold*'. * tests/guix-lint.sh: Add test.
This commit is contained in:
parent
30347040de
commit
8fbf530260
|
@ -482,7 +482,7 @@ Run a set of checkers on the specified package; if none is specified, run the ch
|
||||||
;; * --certainty=[low,medium,high]: only run checkers that have at least this
|
;; * --certainty=[low,medium,high]: only run checkers that have at least this
|
||||||
;; 'certainty'.
|
;; 'certainty'.
|
||||||
(list (option '(#\c "checkers") #t #f
|
(list (option '(#\c "checkers") #t #f
|
||||||
(lambda (opt name arg result arg-handler)
|
(lambda (opt name arg result)
|
||||||
(let ((names (map string->symbol (string-split arg #\,))))
|
(let ((names (map string->symbol (string-split arg #\,))))
|
||||||
(for-each (lambda (c)
|
(for-each (lambda (c)
|
||||||
(unless (memq c
|
(unless (memq c
|
||||||
|
@ -490,13 +490,12 @@ Run a set of checkers on the specified package; if none is specified, run the ch
|
||||||
%checkers))
|
%checkers))
|
||||||
(leave (_ "~a: invalid checker~%") c)))
|
(leave (_ "~a: invalid checker~%") c)))
|
||||||
names)
|
names)
|
||||||
(values (alist-cons 'checkers
|
(alist-cons 'checkers
|
||||||
(filter (lambda (checker)
|
(filter (lambda (checker)
|
||||||
(member (lint-checker-name checker)
|
(member (lint-checker-name checker)
|
||||||
names))
|
names))
|
||||||
%checkers)
|
%checkers)
|
||||||
result)
|
result))))
|
||||||
#f))))
|
|
||||||
(option '(#\h "help") #f #f
|
(option '(#\h "help") #f #f
|
||||||
(lambda args
|
(lambda args
|
||||||
(show-help)
|
(show-help)
|
||||||
|
@ -517,11 +516,11 @@ Run a set of checkers on the specified package; if none is specified, run the ch
|
||||||
(define (parse-options)
|
(define (parse-options)
|
||||||
;; Return the alist of option values.
|
;; Return the alist of option values.
|
||||||
(args-fold* args %options
|
(args-fold* args %options
|
||||||
(lambda (opt name arg result arg-handler)
|
(lambda (opt name arg result)
|
||||||
(leave (_ "~A: unrecognized option~%") name))
|
(leave (_ "~A: unrecognized option~%") name))
|
||||||
(lambda (arg result arg-handler)
|
(lambda (arg result)
|
||||||
(alist-cons 'argument arg result))
|
(alist-cons 'argument arg result))
|
||||||
%default-options #f))
|
%default-options))
|
||||||
|
|
||||||
(let* ((opts (parse-options))
|
(let* ((opts (parse-options))
|
||||||
(args (filter-map (match-lambda
|
(args (filter-map (match-lambda
|
||||||
|
|
|
@ -73,3 +73,6 @@ then false; else true; fi
|
||||||
if guix lint -c synopsis,invalid-checker dummy 2>&1 | \
|
if guix lint -c synopsis,invalid-checker dummy 2>&1 | \
|
||||||
grep -q 'invalid-checker: invalid checker'
|
grep -q 'invalid-checker: invalid checker'
|
||||||
then true; else false; fi
|
then true; else false; fi
|
||||||
|
|
||||||
|
# Make sure specifying multiple packages works.
|
||||||
|
guix lint -c inputs-should-be-native dummy dummy-42 dummy
|
||||||
|
|
Loading…
Reference in New Issue