diff options
| author | zimoun <zimon.toutoune@gmail.com> | 2020-05-11 01:40:44 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2020-05-11 23:30:54 +0200 |
| commit | baf1ce82b1fa4ccdfe79d2d3d2695c063ead321c (patch) | |
| tree | 20d14d539cf47820f193d961a4b56e947a7f4f80 | |
| parent | bdc801e1cfa8e436890da5bd755dd7759cb0f748 (diff) | |
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.scm | 33 | ||||
| -rw-r--r-- | guix/scripts/show.scm | 2 |
2 files changed, 22 insertions, 13 deletions
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index dce9256bf5a..a69efa365e0 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | ;;; Copyright © 2016 Chris Marusich <cmmarusich@gmail.com> | 8 | ;;; Copyright © 2016 Chris Marusich <cmmarusich@gmail.com> |
| 9 | ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr> | 9 | ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr> |
| 10 | ;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net> | 10 | ;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net> |
| 11 | ;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com> | ||
| 11 | ;;; | 12 | ;;; |
| 12 | ;;; This file is part of GNU Guix. | 13 | ;;; This file is part of GNU Guix. |
| 13 | ;;; | 14 | ;;; |
| @@ -787,18 +788,26 @@ processed, #f otherwise." | |||
| 787 | (display-search-results matches (current-output-port))) | 788 | (display-search-results matches (current-output-port))) |
| 788 | #t)) | 789 | #t)) |
| 789 | 790 | ||
| 790 | (('show requested-name) | 791 | (('show _) |
| 791 | (let-values (((name version) | 792 | (let ((requested-names |
| 792 | (package-name->name+version requested-name))) | 793 | (filter-map (match-lambda |
| 793 | (match (remove package-superseded | 794 | (('query 'show requested-name) requested-name) |
| 794 | (find-packages-by-name name version)) | 795 | (_ #f)) |
| 795 | (() | 796 | opts))) |
| 796 | (leave (G_ "~a~@[@~a~]: package not found~%") name version)) | 797 | (for-each |
| 797 | (packages | 798 | (lambda (requested-name) |
| 798 | (leave-on-EPIPE | 799 | (let-values (((name version) |
| 799 | (for-each (cute package->recutils <> (current-output-port)) | 800 | (package-name->name+version requested-name))) |
| 800 | packages)))) | 801 | (match (remove package-superseded |
| 801 | #t)) | 802 | (find-packages-by-name name version)) |
| 803 | (() | ||
| 804 | (leave (G_ "~a~@[@~a~]: package not found~%") name version)) | ||
| 805 | (packages | ||
| 806 | (leave-on-EPIPE | ||
| 807 | (for-each (cute package->recutils <> (current-output-port)) | ||
| 808 | packages)))))) | ||
| 809 | requested-names)) | ||
| 810 | #t) | ||
| 802 | 811 | ||
| 803 | (('search-paths kind) | 812 | (('search-paths kind) |
| 804 | (let* ((manifests (map profile-manifest profiles)) | 813 | (let* ((manifests (map profile-manifest profiles)) |
diff --git a/guix/scripts/show.scm b/guix/scripts/show.scm index ef64b5755bc..a2b0030a634 100644 --- a/guix/scripts/show.scm +++ b/guix/scripts/show.scm | |||
| @@ -73,4 +73,4 @@ This is an alias for 'guix package --show='.\n")) | |||
| 73 | (unless (assoc-ref opts 'query) | 73 | (unless (assoc-ref opts 'query) |
| 74 | (leave (G_ "missing arguments: no package to show~%"))) | 74 | (leave (G_ "missing arguments: no package to show~%"))) |
| 75 | 75 | ||
| 76 | (guix-package* opts)) | 76 | (guix-package* (reverse opts))) |
