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