1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2019 Simon Tournier <zimon.toutoune@gmail.com>
4 ;;; This file is part of GNU Guix.
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.
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.
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/>.
19 (define-module (guix scripts show)
20 #:use-module (guix ui)
21 #:use-module (guix scripts package)
22 #:use-module ((guix scripts build)
23 #:select (%standard-build-options))
24 #:use-module (guix scripts)
25 #:use-module (srfi srfi-1)
26 #:use-module (srfi srfi-26)
27 #:use-module (srfi srfi-37)
31 (display (G_ "Usage: guix show [OPTION] PACKAGE...
32 Show details about PACKAGE."))
34 This is an alias for 'guix package --show='.\n"))
37 -h, --help display this help and exit"))
39 -V, --version display version information and exit"))
42 -L, --load-path=DIR prepend DIR to the package module search path"))
44 (show-bug-report-information))
47 ;; Specification of the command-line options.
48 (list (option '(#\h "help") #f #f
52 (option '(#\V "version") #f #f
54 (show-version-and-exit "guix show")))
56 (find (lambda (option)
57 (member "load-path" (option-names option)))
58 %standard-build-options)))
60 (define (guix-show . args)
61 (define (handle-argument arg result)
62 ;; Treat all non-option arguments as regexps.
63 (cons `(query show ,arg)
67 (args-fold* args %options
68 (lambda (opt name arg . rest)
69 (leave (G_ "~A: unrecognized option~%") name))
73 (unless (assoc-ref opts 'query)
74 (leave (G_ "missing arguments: no package to show~%")))