Commit | Line | Data |
---|---|---|
d007d8a1 AK |
1 | ;;; guix-read.el --- Minibuffer readers |
2 | ||
71310ccc | 3 | ;; Copyright © 2015, 2016 Alex Kost <alezost@gmail.com> |
d007d8a1 AK |
4 | |
5 | ;; This file is part of GNU Guix. | |
6 | ||
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. | |
11 | ||
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. | |
16 | ||
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/>. | |
19 | ||
20 | ;;; Commentary: | |
21 | ||
22 | ;; This file provides functions to prompt a user for packages, system | |
23 | ;; types, hash formats and other guix related stuff. | |
24 | ||
25 | ;;; Code: | |
26 | ||
27 | (require 'guix-help-vars) | |
28 | (require 'guix-utils) | |
b1990426 AK |
29 | (require 'guix-backend) |
30 | (require 'guix-guile) | |
31 | ||
32 | \f | |
33 | ;;; Receivable lists of packages, lint checkers, etc. | |
34 | ||
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))) | |
38 | ||
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))) | |
42 | ||
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))) | |
46 | ||
47 | (guix-memoized-defun guix-package-names () | |
48 | "Return a list of names of available packages." | |
49 | (sort | |
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'. | |
53 | ||
54 | ;; (guix-eval-read (guix-make-guile-expression 'package-names)) | |
55 | ||
56 | (mapcar #'car | |
57 | (guix-eval-read (guix-make-guile-expression | |
58 | 'package-names-lists))) | |
59 | #'string<)) | |
60 | ||
71310ccc AK |
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))) | |
64 | ||
b4ea535a AK |
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)) | |
69 | #'string<)) | |
70 | ||
b1990426 AK |
71 | \f |
72 | ;;; Readers | |
d007d8a1 AK |
73 | |
74 | (guix-define-readers | |
75 | :completions-var guix-help-system-types | |
76 | :single-reader guix-read-system-type | |
77 | :single-prompt "System type: ") | |
78 | ||
79 | (guix-define-readers | |
80 | :completions-var guix-help-source-types | |
81 | :single-reader guix-read-source-type | |
82 | :single-prompt "Source type: ") | |
83 | ||
84 | (guix-define-readers | |
85 | :completions-var guix-help-hash-formats | |
86 | :single-reader guix-read-hash-format | |
87 | :single-prompt "Hash format: ") | |
88 | ||
89 | (guix-define-readers | |
90 | :completions-var guix-help-refresh-subsets | |
91 | :single-reader guix-read-refresh-subset | |
92 | :single-prompt "Refresh subset: ") | |
93 | ||
6407ce8e AK |
94 | (guix-define-readers |
95 | :completions-getter guix-refresh-updater-names | |
96 | :multiple-reader guix-read-refresh-updater-names | |
97 | :multiple-prompt "Refresh updater,s: " | |
98 | :multiple-separator ",") | |
99 | ||
d007d8a1 AK |
100 | (guix-define-readers |
101 | :completions-var guix-help-key-policies | |
102 | :single-reader guix-read-key-policy | |
103 | :single-prompt "Key policy: ") | |
104 | ||
105 | (guix-define-readers | |
106 | :completions-var guix-help-elpa-archives | |
107 | :single-reader guix-read-elpa-archive | |
108 | :single-prompt "ELPA archive: ") | |
109 | ||
110 | (guix-define-readers | |
111 | :completions-var guix-help-verify-options | |
112 | :multiple-reader guix-read-verify-options | |
113 | :multiple-prompt "Verify option,s: " | |
114 | :multiple-separator ",") | |
115 | ||
116 | (guix-define-readers | |
117 | :completions-getter guix-graph-type-names | |
118 | :single-reader guix-read-graph-type | |
119 | :single-prompt "Graph node type: ") | |
120 | ||
121 | (guix-define-readers | |
122 | :completions-getter guix-lint-checker-names | |
123 | :multiple-reader guix-read-lint-checker-names | |
124 | :multiple-prompt "Linter,s: " | |
125 | :multiple-separator ",") | |
126 | ||
127 | (guix-define-readers | |
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 " ") | |
134 | ||
71310ccc AK |
135 | (guix-define-readers |
136 | :completions-getter guix-license-names | |
137 | :single-reader guix-read-license-name | |
138 | :single-prompt "License: ") | |
139 | ||
b4ea535a AK |
140 | (guix-define-readers |
141 | :completions-getter guix-package-locations | |
142 | :single-reader guix-read-package-location | |
143 | :single-prompt "Location: ") | |
144 | ||
d007d8a1 AK |
145 | (provide 'guix-read) |
146 | ||
147 | ;;; guix-read.el ends here |