guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/04: lint: Fix argument parsing when several packages are specified.


From: Ludovic Courtès
Subject: 01/04: lint: Fix argument parsing when several packages are specified.
Date: Wed, 28 Jan 2015 13:40:02 +0000

civodul pushed a commit to branch master
in repository guix.

commit 8fbf530260ec4b269e224de272727a3b4987296b
Author: Ludovic Courtès <address@hidden>
Date:   Wed Jan 28 14:00:58 2015 +0100

    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.
---
 guix/scripts/lint.scm |   21 ++++++++++-----------
 tests/guix-lint.sh    |    3 +++
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm
index 229b737..9d5c689 100644
--- a/guix/scripts/lint.scm
+++ b/guix/scripts/lint.scm
@@ -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'.
   (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 #\,))))
                     (for-each (lambda (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))
                                   (leave (_ "~a: invalid checker~%") c)))
                               names)
-                    (values (alist-cons 'checkers
-                             (filter (lambda (checker)
-                                       (member (lint-checker-name checker)
-                                               names))
-                                     %checkers)
-                             result)
-                            #f))))
+                    (alist-cons 'checkers
+                                (filter (lambda (checker)
+                                          (member (lint-checker-name checker)
+                                                  names))
+                                        %checkers)
+                                result))))
         (option '(#\h "help") #f #f
                 (lambda args
                   (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)
     ;; Return the alist of option values.
     (args-fold* args %options
-                (lambda (opt name arg result arg-handler)
+                (lambda (opt name arg result)
                   (leave (_ "~A: unrecognized option~%") name))
-                (lambda (arg result arg-handler)
+                (lambda (arg result)
                   (alist-cons 'argument arg result))
-                %default-options #f))
+                %default-options))
 
   (let* ((opts (parse-options))
          (args (filter-map (match-lambda
diff --git a/tests/guix-lint.sh b/tests/guix-lint.sh
index b48cd4e..5015b5c 100644
--- a/tests/guix-lint.sh
+++ b/tests/guix-lint.sh
@@ -73,3 +73,6 @@ then false; else true; fi
 if guix lint -c synopsis,invalid-checker dummy 2>&1 | \
    grep -q 'invalid-checker: invalid checker'
 then true; else false; fi
+
+# Make sure specifying multiple packages works.
+guix lint -c inputs-should-be-native dummy dummy-42 dummy



reply via email to

[Prev in Thread] Current Thread [Next in Thread]