1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015 David Thompson <davet@gnu.org>
3 ;;; Copyright © 2018 Kyle Meyer <kyle@kyleam.com>
5 ;;; This file is part of GNU Guix.
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20 (define-module (guix scripts container)
21 #:use-module (ice-9 match)
22 #:use-module (guix ui)
23 #:export (guix-container))
26 (display (G_ "Usage: guix container ACTION ARGS...
27 Build and manipulate Linux containers.\n"))
29 (display (G_ "The valid values for ACTION are:\n"))
32 exec execute a command inside of an existing container\n"))
35 -h, --help display this help and exit"))
37 -V, --version display version information and exit"))
39 (show-bug-report-information))
41 (define %actions '("exec"))
43 (define (resolve-action name)
44 (let ((module (resolve-interface
45 `(guix scripts container ,(string->symbol name))))
46 (proc (string->symbol (string-append "guix-container-" name))))
47 (module-ref module proc)))
49 (define (guix-container . args)
53 (format (current-error-port)
54 (G_ "guix container: missing action~%")))
55 ((or ("-h") ("--help"))
58 ((or ("-V") ("--version"))
59 (show-version-and-exit "guix container"))
61 (if (member action %actions)
62 (apply (resolve-action action) args)
63 (format (current-error-port)
64 (G_ "guix container: invalid action~%")))))))