summary refs log tree commit diff
diff options
context:
space:
mode:
authorzimoun <zimon.toutoune@gmail.com>2020-05-11 01:40:44 +0200
committerLudovic Courtès <ludo@gnu.org>2020-05-11 23:30:54 +0200
commitbaf1ce82b1fa4ccdfe79d2d3d2695c063ead321c (patch)
tree20d14d539cf47820f193d961a4b56e947a7f4f80
parentbdc801e1cfa8e436890da5bd755dd7759cb0f748 (diff)
downloadguix-baf1ce82b1fa4ccdfe79d2d3d2695c063ead321c.tar.gz
guix package, show: Support multiple queries.
* guix/scripts/package.scm (process-query): Show multiple queries.
* guix/scripts/show.scm (guix-show): Reverse to display in order.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r--guix/scripts/package.scm33
-rw-r--r--guix/scripts/show.scm2
2 files changed, 22 insertions, 13 deletions
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index dce9256bf5..a69efa365e 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2016 Chris Marusich <cmmarusich@gmail.com>
 ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -787,18 +788,26 @@ processed, #f otherwise."
           (display-search-results matches (current-output-port)))
          #t))
 
-      (('show requested-name)
-       (let-values (((name version)
-                     (package-name->name+version requested-name)))
-         (match (remove package-superseded
-                        (find-packages-by-name name version))
-           (()
-            (leave (G_ "~a~@[@~a~]: package not found~%") name version))
-           (packages
-            (leave-on-EPIPE
-             (for-each (cute package->recutils <> (current-output-port))
-                       packages))))
-         #t))
+      (('show _)
+       (let ((requested-names
+              (filter-map (match-lambda
+                            (('query 'show requested-name) requested-name)
+                            (_                            #f))
+                          opts)))
+         (for-each
+          (lambda (requested-name)
+            (let-values (((name version)
+                          (package-name->name+version requested-name)))
+              (match (remove package-superseded
+                             (find-packages-by-name name version))
+                (()
+                 (leave (G_ "~a~@[@~a~]: package not found~%") name version))
+                (packages
+                 (leave-on-EPIPE
+                  (for-each (cute package->recutils <> (current-output-port))
+                            packages))))))
+          requested-names))
+       #t)
 
       (('search-paths kind)
        (let* ((manifests (map profile-manifest profiles))
diff --git a/guix/scripts/show.scm b/guix/scripts/show.scm
index ef64b5755b..a2b0030a63 100644
--- a/guix/scripts/show.scm
+++ b/guix/scripts/show.scm
@@ -73,4 +73,4 @@ This is an alias for 'guix package --show='.\n"))
   (unless (assoc-ref opts 'query)
     (leave (G_ "missing arguments: no package to show~%")))
 
-  (guix-package* opts))
+  (guix-package* (reverse opts)))