1 ;;; guix-read.el --- Minibuffer readers
3 ;; Copyright © 2015, 2016 Alex Kost <alezost@gmail.com>
5 ;; This file is part of GNU Guix.
7 ;; GNU Guix is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation, either version 3 of the License, or
10 ;; (at your option) any later version.
12 ;; GNU Guix is distributed in the hope that it will be useful,
13 ;; but 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 this program. If not, see <http://www.gnu.org/licenses/>.
22 ;; This file provides functions to prompt a user for packages, system
23 ;; types, hash formats and other guix related stuff.
27 (require 'guix-help-vars
)
29 (require 'guix-backend
)
33 ;;; Receivable lists of packages, lint checkers, etc.
35 (guix-memoized-defun guix-graph-type-names ()
36 "Return a list of names of available graph node types."
37 (guix-eval-read (guix-make-guile-expression 'graph-type-names
)))
39 (guix-memoized-defun guix-refresh-updater-names ()
40 "Return a list of names of available refresh updater types."
41 (guix-eval-read (guix-make-guile-expression 'refresh-updater-names
)))
43 (guix-memoized-defun guix-lint-checker-names ()
44 "Return a list of names of available lint checkers."
45 (guix-eval-read (guix-make-guile-expression 'lint-checker-names
)))
47 (guix-memoized-defun guix-package-names ()
48 "Return a list of names of available packages."
50 ;; Work around <https://github.com/jaor/geiser/issues/64>:
51 ;; list of strings is parsed much slower than list of lists,
52 ;; so we use 'package-names-lists' instead of 'package-names'.
54 ;; (guix-eval-read (guix-make-guile-expression 'package-names))
57 (guix-eval-read (guix-make-guile-expression
58 'package-names-lists
)))
61 (guix-memoized-defun guix-license-names ()
62 "Return a list of names of available licenses."
63 (guix-eval-read (guix-make-guile-expression 'license-names
)))
65 (guix-memoized-defun guix-package-locations ()
66 "Return a list of available package locations."
67 (sort (guix-eval-read (guix-make-guile-expression
68 'package-location-files
))
75 :completions-var guix-help-system-types
76 :single-reader guix-read-system-type
77 :single-prompt
"System type: ")
80 :completions-var guix-help-source-types
81 :single-reader guix-read-source-type
82 :single-prompt
"Source type: ")
85 :completions-var guix-help-hash-formats
86 :single-reader guix-read-hash-format
87 :single-prompt
"Hash format: ")
90 :completions-var guix-help-refresh-subsets
91 :single-reader guix-read-refresh-subset
92 :single-prompt
"Refresh subset: ")
95 :completions-getter guix-refresh-updater-names
96 :multiple-reader guix-read-refresh-updater-names
97 :multiple-prompt
"Refresh updater,s: "
98 :multiple-separator
",")
101 :completions-var guix-help-key-policies
102 :single-reader guix-read-key-policy
103 :single-prompt
"Key policy: ")
106 :completions-var guix-help-elpa-archives
107 :single-reader guix-read-elpa-archive
108 :single-prompt
"ELPA archive: ")
111 :completions-var guix-help-verify-options
112 :multiple-reader guix-read-verify-options
113 :multiple-prompt
"Verify option,s: "
114 :multiple-separator
",")
117 :completions-getter guix-graph-type-names
118 :single-reader guix-read-graph-type
119 :single-prompt
"Graph node type: ")
122 :completions-getter guix-lint-checker-names
123 :multiple-reader guix-read-lint-checker-names
124 :multiple-prompt
"Linter,s: "
125 :multiple-separator
",")
128 :completions-getter guix-package-names
129 :single-reader guix-read-package-name
130 :single-prompt
"Package: "
131 :multiple-reader guix-read-package-names
132 :multiple-prompt
"Package,s: "
133 :multiple-separator
" ")
136 :completions-getter guix-license-names
137 :single-reader guix-read-license-name
138 :single-prompt
"License: ")
141 :completions-getter guix-package-locations
142 :single-reader guix-read-package-location
143 :single-prompt
"Location: ")
147 ;;; guix-read.el ends here