~ chicken-core (chicken-5) 138a16f20a97728d9da2b5e590dc5e0d0c7c15e3


commit 138a16f20a97728d9da2b5e590dc5e0d0c7c15e3
Author:     Evan Hanson <evhan@foldling.org>
AuthorDate: Wed Jul 25 20:17:33 2018 +1200
Commit:     Peter Bex <peter@more-magic.net>
CommitDate: Sun Jul 29 19:58:30 2018 +0200

    Allow "chicken-status -list" to be used with egg name arguments
    
    This allows `chicken-status -list NAME ...` to generate output for just
    the named eggs (or the eggs specified by a pattern with "-match"), like
    we do with "-c" and "-f".
    
    The default behaviour, listing all installed eggs, remains the same when
    no name arguments are given.
    
    Signed-off-by: Peter Bex <peter@more-magic.net>

diff --git a/chicken-status.scm b/chicken-status.scm
index 7a0a9b2d..e361fc86 100644
--- a/chicken-status.scm
+++ b/chicken-status.scm
@@ -185,13 +185,13 @@
        eggs)
       string<?)))
 
-  (define (dump-installed-versions)
+  (define (dump-installed-versions eggs)
     (for-each
      (lambda (egg)
        (let ((version (get-egg-property (read-info egg) 'version)))
 	 (pp (cons (string->symbol egg)
                    (if version (list version) '())))))
-     (gather-eggs)))
+     eggs))
 
   (define (usage code)
     (print #<<EOF
@@ -225,15 +225,15 @@ EOF
                      (cut print "-components cannot be used with -list."))
                    (exit 1))
                   (cached (list-cached-eggs))
-                  (dump (dump-installed-versions))
                   (else
-                    (let ((eggs (filter-eggs pats mtch)))
-                      (if (null? eggs)
-                          (display "(none)\n" (current-error-port))
-                          ((cond (comps list-installed-components)
-                                 (files list-installed-files)
-                                 (else list-installed-eggs))
-                           eggs)))))
+                   (let ((eggs (filter-eggs pats mtch)))
+                     (if (null? eggs)
+                         (display "(none)\n" (current-error-port))
+                         ((cond (dump dump-installed-versions)
+                                (files list-installed-files)
+                                (comps list-installed-components)
+                                (else list-installed-eggs))
+                          eggs)))))
             (let ((arg (car args)))
               (cond ((member arg '("-help" "-h" "--help"))
                      (usage 0))
Trap