gnu: perl-email-abstract: Update to 3.009.
[jackhill/guix/guix.git] / gnu / packages / shellutils.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016 Matthew Jordan <matthewjordandevops@yandex.com>
3 ;;; Copyright © 2016, 2017 Alex Griffin <a@ajgrf.com>
4 ;;; Copyright © 2016 Christopher Baines <mail@cbaines.net>
5 ;;; Copyright © 2017 Stefan Reichör <stefan@xsteve.at>
6 ;;; Copyright © 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2018 Benjamin Slade <slade@jnanam.net>
8 ;;; Copyright © 2019 Collin J. Doering <collin@rekahsoft.ca>
9 ;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
10 ;;; Copyright © 2020 aecepoglu <aecepoglu@fastmail.fm>
11 ;;; Copyright © 2020 Dion Mendel <guix@dm9.info>
12 ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
13 ;;;
14 ;;; This file is part of GNU Guix.
15 ;;;
16 ;;; GNU Guix is free software; you can redistribute it and/or modify it
17 ;;; under the terms of the GNU General Public License as published by
18 ;;; the Free Software Foundation; either version 3 of the License, or (at
19 ;;; your option) any later version.
20 ;;;
21 ;;; GNU Guix is distributed in the hope that it will be useful, but
22 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 ;;; GNU General Public License for more details.
25 ;;;
26 ;;; You should have received a copy of the GNU General Public License
27 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28
29 (define-module (gnu packages shellutils)
30 #:use-module ((guix licenses) #:prefix license:)
31 #:use-module (guix utils)
32 #:use-module (guix packages)
33 #:use-module (guix download)
34 #:use-module (guix git-download)
35 #:use-module (guix build-system gnu)
36 #:use-module (guix build-system go)
37 #:use-module (guix build-system python)
38 #:use-module (gnu packages autotools)
39 #:use-module (gnu packages base)
40 #:use-module (gnu packages bison)
41 #:use-module (gnu packages flex)
42 #:use-module (gnu packages golang)
43 #:use-module (gnu packages ncurses)
44 #:use-module (gnu packages pkg-config)
45 #:use-module (gnu packages python)
46 #:use-module (gnu packages readline)
47 #:use-module (gnu packages ruby)
48 #:use-module (gnu packages shells)
49 #:use-module (gnu packages tmux))
50
51 (define-public boxes
52 (package
53 (name "boxes")
54 (version "1.3")
55 (source (origin
56 (method git-fetch)
57 (uri (git-reference
58 (url "https://github.com/ascii-boxes/boxes")
59 (commit (string-append "v" version))))
60 (file-name (git-file-name name version))
61 (sha256
62 (base32
63 "0b12rsynrmkldlwcb62drk33kk0aqwbj10mq5y5x3hjf626gjwsi"))))
64 (build-system gnu-build-system)
65 (arguments
66 `(#:test-target "test"
67 #:make-flags (list (string-append "GLOBALCONF="
68 (assoc-ref %outputs "out")
69 "/etc/boxes-config"))
70 #:phases
71 (modify-phases %standard-phases
72 (delete 'configure)
73 (replace 'install
74 (lambda* (#:key outputs #:allow-other-keys)
75 (let ((dest (assoc-ref outputs "out")))
76 (for-each (lambda (x)
77 (install-file (car x)
78 (string-append dest "/" (cdr x))))
79 '(("src/boxes" . "bin")
80 ("doc/boxes.1" . "share/man/man1")
81 ("boxes-config" . "etc/")))
82 #t))))))
83 (native-inputs `(("flex" ,flex) ("bison" ,bison)))
84 (synopsis "Command line ASCII boxes")
85 (description
86 "This command-line filter program draws ASCII-art boxes around your input
87 text.")
88 (home-page "https://boxes.thomasjensen.com/build.html")
89 (license license:gpl2)))
90
91 (define-public zsh-autosuggestions
92 (package
93 (name "zsh-autosuggestions")
94 (version "0.7.0")
95 (source (origin
96 (method git-fetch)
97 (uri (git-reference
98 (url "https://github.com/zsh-users/zsh-autosuggestions")
99 (commit (string-append "v" version))))
100 (file-name (git-file-name name version))
101 (sha256
102 (base32
103 "1g3pij5qn2j7v7jjac2a63lxd97mcsgw6xq6k5p7835q9fjiid98"))))
104 (build-system gnu-build-system)
105 (native-inputs
106 `(("ruby" ,ruby)
107 ("ruby-byebug" ,ruby-byebug)
108 ("ruby-pry" ,ruby-pry)
109 ("ruby-rspec" ,ruby-rspec)
110 ("ruby-rspec-wait" ,ruby-rspec-wait)
111 ("tmux" ,tmux)
112 ("zsh" ,zsh)))
113 (arguments
114 '(#:phases
115 (modify-phases %standard-phases
116 (add-after 'unpack 'patch-tests
117 (lambda _
118 ;; Failing tests since tmux-3.2a
119 (delete-file "spec/options/buffer_max_size_spec.rb")))
120 (delete 'configure)
121 (replace 'check ; Tests use ruby's bundler; instead execute rspec directly.
122 (lambda _
123 (setenv "TMUX_TMPDIR" (getenv "TMPDIR"))
124 (setenv "SHELL" (which "zsh"))
125 (invoke "rspec")))
126 (replace 'install
127 (lambda* (#:key outputs #:allow-other-keys)
128 (let* ((out (assoc-ref outputs "out"))
129 (zsh-plugins
130 (string-append out "/share/zsh/plugins/zsh-autosuggestions")))
131 (invoke "make" "all")
132 (install-file "zsh-autosuggestions.zsh" zsh-plugins)
133 #t))))))
134 (home-page "https://github.com/zsh-users/zsh-autosuggestions")
135 (synopsis "Fish-like autosuggestions for zsh")
136 (description
137 "Fish-like fast/unobtrusive autosuggestions for zsh. It suggests commands
138 as you type.")
139 (license license:expat)))
140
141 (define-public sh-z
142 (package
143 (name "sh-z")
144 (version "1.11")
145 (source (origin
146 (method git-fetch)
147 (uri (git-reference
148 (url "https://github.com/rupa/z")
149 (commit (string-append "v" version))))
150 (file-name (git-file-name name version))
151 (sha256
152 (base32
153 "13zbgkj6y0qhvn5jpkrqbd4jjxjr789k228iwma5hjfh1nx7ghyb"))))
154 (build-system gnu-build-system)
155 (arguments
156 `(#:tests? #f ; No tests provided
157 #:phases
158 (modify-phases %standard-phases
159 (delete 'configure)
160 (delete 'build)
161 (replace 'install
162 (lambda* (#:key outputs #:allow-other-keys)
163 (let* ((out (assoc-ref outputs "out"))
164 (man (string-append out "/share/man/man1"))
165 (bin (string-append out "/bin")))
166 (install-file "z.sh" bin)
167 (chmod (string-append bin "/z.sh") #o755)
168 (install-file "z.1" man)
169 #t))))))
170 (synopsis "Jump about directories")
171 (description
172 "Tracks your most used directories, based on ``frecency''. After a short
173 learning phase, z will take you to the most ``frecent'' directory that matches
174 all of the regexes given on the command line in order.")
175 (home-page "https://github.com/rupa/z")
176 (license license:expat)))
177
178 (define-public envstore
179 (package
180 (name "envstore")
181 (version "2.1")
182 (source
183 (origin
184 (method url-fetch)
185 (uri (string-append "https://finalrewind.org/projects/"
186 name "/" name "-" version ".tar.bz2"))
187 (sha256
188 (base32 "1x97lxad80m5blhdfanl5v2qzjwcgbij2i23701bn8mpyxsrqszi"))))
189 (build-system gnu-build-system)
190 (arguments
191 `(#:test-target "test"
192 #:make-flags (list "CC=gcc"
193 (string-append "PREFIX=" (assoc-ref %outputs "out")))
194 #:phases
195 (modify-phases %standard-phases
196 (delete 'configure))))
197 (home-page "https://finalrewind.org/projects/envstore/")
198 (synopsis "Save and restore environment variables")
199 (description "Envstore is a program for sharing environment variables
200 between various shells or commands.")
201 (license license:wtfpl2)))
202
203 (define-public trash-cli
204 (package
205 (name "trash-cli")
206 (version "0.17.1.14")
207 (source
208 (origin
209 (method url-fetch)
210 (uri (pypi-uri "trash-cli" version))
211 (sha256
212 (base32
213 "01q0cl04ljf214z6s3g256gsxx3pqsgaf6ac1zh0vrq5bnhnr85h"))))
214 (build-system python-build-system)
215 (arguments
216 `(#:python ,python-2
217 #:tests? #f ; no tests
218 #:phases
219 (modify-phases %standard-phases
220 (add-before 'build 'patch-path-constants
221 (lambda* (#:key inputs #:allow-other-keys)
222 (let ((libc (assoc-ref inputs "libc"))
223 (coreutils (assoc-ref inputs "coreutils")))
224 (substitute* "trashcli/list_mount_points.py"
225 (("\"/lib/libc.so.6\".*")
226 (string-append "\"" libc "/lib/libc.so.6\"\n"))
227 (("\"df\"")
228 (string-append "\"" coreutils "/bin/df\"")))))))))
229 (inputs `(("coreutils" ,coreutils)))
230 (home-page "https://github.com/andreafrancia/trash-cli")
231 (synopsis "Trash can management tool")
232 (description
233 "trash-cli is a command line utility for interacting with the
234 FreeDesktop.org trash can used by GNOME, KDE, XFCE, and other common desktop
235 environments. It can move files to the trash, and remove or list files that
236 are already there.")
237 (license license:gpl2+)))
238
239 (define-public direnv
240 (package
241 (name "direnv")
242 (version "2.15.2")
243 (source
244 (origin (method git-fetch)
245 (uri (git-reference
246 (url "https://github.com/direnv/direnv")
247 (commit (string-append "v" version))))
248 (file-name (git-file-name name version))
249 (sha256
250 (base32
251 "1y18619pmhfl0vrf4w0h75ybkkwgi9wcb7d9kv4n8drg1xp4aw4w"))))
252 (build-system go-build-system)
253 (arguments
254 '(#:import-path "github.com/direnv/direnv"
255 #:phases
256 (modify-phases %standard-phases
257 (add-after 'unpack 'delete-vendor
258 (lambda _
259 ;; Using a snippet causes issues with the name of the directory,
260 ;; so delete the extra source code here.
261 (delete-file-recursively "src/github.com/direnv/direnv/vendor")
262 #t))
263 (add-after 'install 'install-manpages
264 (lambda* (#:key outputs #:allow-other-keys)
265 (let* ((out (assoc-ref outputs "out"))
266 (man (string-append out "/share/man/man1")))
267 (mkdir-p man)
268 (with-directory-excursion "src/github.com/direnv/direnv"
269 (install-file "man/direnv.1" man)
270 (install-file "man/direnv-stdlib.1" man)
271 (install-file "man/direnv.toml.1" man)))))
272 (replace 'check
273 (lambda* (#:key tests? #:allow-other-keys)
274 (when tests?
275 (setenv "HOME" "/tmp")
276 (with-directory-excursion "src/github.com/direnv/direnv"
277 ;; The following file needs to be writable so it can be
278 ;; modified by the testsuite.
279 (make-file-writable "test/scenarios/base/.envrc")
280 (invoke "make" "test")
281 ;; Clean up from the tests, especially so that the extra
282 ;; direnv executable that's generated is removed.
283 (invoke "make" "clean")))
284 #t)))))
285 (native-inputs
286 `(("go-github-com-burntsushi-toml" ,go-github-com-burntsushi-toml)
287 ("go-github-com-direnv-go-dotenv" ,go-github-com-direnv-go-dotenv)
288 ("which" ,which)))
289 (home-page "https://direnv.net/")
290 (synopsis "Environment switcher for the shell")
291 (description
292 "direnv can hook into the bash, zsh, tcsh, and fish shells to load
293 or unload environment variables depending on the current directory. This
294 allows project-specific environment variables without using @file{~/.profile}.
295
296 Before each prompt, direnv checks for the existence of a @file{.envrc} file in
297 the current and parent directories. This file is then used to alter the
298 environment variables of the current shell.")
299 (license license:expat)))
300
301 (define-public fzy
302 (package
303 (name "fzy")
304 (version "1.0")
305 (source
306 (origin
307 (method git-fetch)
308 (uri (git-reference
309 (url "https://github.com/jhawthorn/fzy")
310 (commit version)))
311 (file-name (git-file-name name version))
312 (sha256
313 (base32
314 "1gkzdvj73f71388jvym47075l9zw61v6l8wdv2lnc0mns6dxig0k"))))
315 (build-system gnu-build-system)
316 (arguments
317 '(#:make-flags (list "CC=gcc"
318 (string-append "PREFIX=" (assoc-ref %outputs "out")))
319 #:phases
320 (modify-phases %standard-phases
321 (delete 'configure))))
322 (home-page "https://github.com/jhawthorn/fzy")
323 (synopsis "Fast fuzzy text selector for the terminal with an advanced
324 scoring algorithm")
325 (description
326 "Most other fuzzy matchers sort based on the length of a match. fzy tries
327 to find the result the user intended. It does this by favouring matches on
328 consecutive letters and starts of words. This allows matching using acronyms
329 or different parts of the path.
330
331 fzy is designed to be used both as an editor plugin and on the command
332 line. Rather than clearing the screen, fzy displays its interface directly
333 below the current cursor position, scrolling the screen if necessary.")
334 (license license:expat)))
335
336 (define-public hstr
337 (package
338 (name "hstr")
339 (version "2.3")
340 (source (origin
341 (method git-fetch)
342 (uri (git-reference
343 (url "https://github.com/dvorka/hstr")
344 (commit version)))
345 (file-name (git-file-name name version))
346 (sha256
347 (base32
348 "1chmfdi1dwg3sarzd01nqa82g65q7wdr6hrnj96l75vikwsg986y"))))
349 (build-system gnu-build-system)
350 (arguments
351 `(#:phases
352 (modify-phases %standard-phases
353 (add-before 'build 'adjust-ncurses-includes
354 (lambda* (#:key make-flags outputs #:allow-other-keys)
355 (let ((out (assoc-ref outputs "out")))
356 (substitute* "src/include/hstr_curses.h"
357 (("ncursesw\\/curses.h") "ncurses.h"))
358 (substitute* "src/include/hstr.h"
359 (("ncursesw\\/curses.h") "ncurses.h")))
360 #t)))))
361 (native-inputs
362 `(("autoconf" ,autoconf)
363 ("automake" ,automake)
364 ("pkg-config" ,pkg-config)))
365 (inputs
366 `(("ncurses" ,ncurses)
367 ("readline" ,readline)))
368 (synopsis "Navigate and search command history with shell history suggest box")
369 (description "HSTR (HiSToRy) is a command-line utility that brings
370 improved Bash and Zsh command completion from the history. It aims to make
371 completion easier and more efficient than with @kbd{Ctrl-R}. It allows you to
372 easily view, navigate, and search your command history with suggestion boxes.
373 HSTR can also manage your command history (for instance you can remove
374 commands that are obsolete or contain a piece of sensitive information) or
375 bookmark your favourite commands.")
376 (home-page "http://me.mindforger.com/projects/hh.html")
377 (license license:asl2.0)))
378
379 (define-public shell-functools
380 (package
381 (name "shell-functools")
382 (version "0.3.0")
383 (source (origin
384 (method git-fetch)
385 (uri (git-reference
386 (url "https://github.com/sharkdp/shell-functools")
387 (commit (string-append "v" version))))
388 (file-name (git-file-name name version))
389 (sha256
390 (base32
391 "0d6zzg7cxfrzwzh1wmpj7q85kz33sak6ac59ncsm6dlbin12h0hi"))))
392 (build-system python-build-system)
393 (home-page "https://github.com/sharkdp/shell-functools/")
394 (synopsis "Functional programming tools for the shell")
395 (description "This package provides higher order functions like map,
396 filter, foldl, sort_by and take_while as simple command-line tools. Following
397 the UNIX philosophy, these commands are designed to be composed via pipes. A
398 large collection of functions such as basename, replace, contains or is_dir
399 are provided as arguments to these commands.")
400 (license license:expat)))