gnu: esbuild: Update to 0.11.14.
[jackhill/guix/guix.git] / guix / scripts / show.scm
CommitLineData
aeb51370 1;;; GNU Guix --- Functional package management for GNU
4056ba36 2;;; Copyright © 2019, 2021 Simon Tournier <zimon.toutoune@gmail.com>
aeb51370 3;;;
4;;; This file is part of GNU Guix.
5;;;
6;;; GNU Guix is free software; you can redistribute it and/or modify it
7;;; under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 3 of the License, or (at
9;;; your option) any later version.
10;;;
11;;; GNU Guix is distributed in the hope that it will be useful, but
12;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19(define-module (guix scripts show)
20 #:use-module (guix ui)
21 #:use-module (guix scripts package)
4f8c29a7
LC
22 #:use-module ((guix scripts build)
23 #:select (%standard-build-options))
aeb51370 24 #:use-module (guix scripts)
25 #:use-module (srfi srfi-1)
26 #:use-module (srfi srfi-26)
27 #:use-module (srfi srfi-37)
28 #:export (guix-show))
29
30(define (show-help)
31 (display (G_ "Usage: guix show [OPTION] PACKAGE...
32Show details about PACKAGE."))
33 (display (G_"
34This is an alias for 'guix package --show='.\n"))
35 (newline)
36 (display (G_ "
37 -h, --help display this help and exit"))
38 (display (G_ "
39 -V, --version display version information and exit"))
40 (newline)
4f8c29a7
LC
41 (display (G_ "
42 -L, --load-path=DIR prepend DIR to the package module search path"))
43 (newline)
aeb51370 44 (show-bug-report-information))
45
46(define %options
47 ;; Specification of the command-line options.
48 (list (option '(#\h "help") #f #f
49 (lambda args
50 (show-help)
51 (exit 0)))
52 (option '(#\V "version") #f #f
53 (lambda args
4f8c29a7
LC
54 (show-version-and-exit "guix show")))
55
56 (find (lambda (option)
57 (member "load-path" (option-names option)))
58 %standard-build-options)))
aeb51370 59
3794ce93
LC
60(define-command (guix-show . args)
61 (synopsis "show information about packages")
62
aeb51370 63 (define (handle-argument arg result)
64 ;; Treat all non-option arguments as regexps.
65 (cons `(query show ,arg)
66 result))
67
68 (define opts
4056ba36 69 (parse-command-line args %options (list (list))
70 #:build-options? #f
71 #:argument-handler handle-argument))
aeb51370 72
73 (unless (assoc-ref opts 'query)
74 (leave (G_ "missing arguments: no package to show~%")))
75
baf1ce82 76 (guix-package* (reverse opts)))