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>
14 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
58 (url "https://github.com/ascii-boxes/boxes")
59 (commit (string-append "v" version))))
60 (file-name (git-file-name name version))
63 "0b12rsynrmkldlwcb62drk33kk0aqwbj10mq5y5x3hjf626gjwsi"))))
64 (build-system gnu-build-system)
66 `(#:test-target "test"
67 #:make-flags (list (string-append "GLOBALCONF="
68 (assoc-ref %outputs "out")
71 (modify-phases %standard-phases
74 (lambda* (#:key outputs #:allow-other-keys)
75 (let ((dest (assoc-ref outputs "out")))
78 (string-append dest "/" (cdr x))))
79 '(("src/boxes" . "bin")
80 ("doc/boxes.1" . "share/man/man1")
81 ("boxes-config" . "etc/")))
83 (native-inputs `(("flex" ,flex) ("bison" ,bison)))
84 (synopsis "Command line ASCII boxes")
86 "This command-line filter program draws ASCII-art boxes around your input
88 (home-page "https://boxes.thomasjensen.com/build.html")
89 (license license:gpl2)))
91 (define-public zsh-autosuggestions
93 (name "zsh-autosuggestions")
98 (url "https://github.com/zsh-users/zsh-autosuggestions")
99 (commit (string-append "v" version))))
100 (file-name (git-file-name name version))
103 "1g3pij5qn2j7v7jjac2a63lxd97mcsgw6xq6k5p7835q9fjiid98"))))
104 (build-system gnu-build-system)
107 ("ruby-byebug" ,ruby-byebug)
108 ("ruby-pry" ,ruby-pry)
109 ("ruby-rspec" ,ruby-rspec)
110 ("ruby-rspec-wait" ,ruby-rspec-wait)
115 (modify-phases %standard-phases
116 (add-after 'unpack 'patch-tests
118 ;; Failing tests since tmux-3.2a
119 (delete-file "spec/options/buffer_max_size_spec.rb")))
121 (replace 'check ; Tests use ruby's bundler; instead execute rspec directly.
123 (setenv "TMUX_TMPDIR" (getenv "TMPDIR"))
124 (setenv "SHELL" (which "zsh"))
127 (lambda* (#:key outputs #:allow-other-keys)
128 (let* ((out (assoc-ref outputs "out"))
130 (string-append out "/share/zsh/plugins/zsh-autosuggestions")))
131 (invoke "make" "all")
132 (install-file "zsh-autosuggestions.zsh" zsh-plugins)
134 (home-page "https://github.com/zsh-users/zsh-autosuggestions")
135 (synopsis "Fish-like autosuggestions for zsh")
137 "Fish-like fast/unobtrusive autosuggestions for zsh. It suggests commands
139 (license license:expat)))
148 (url "https://github.com/rupa/z")
149 (commit (string-append "v" version))))
150 (file-name (git-file-name name version))
153 "13zbgkj6y0qhvn5jpkrqbd4jjxjr789k228iwma5hjfh1nx7ghyb"))))
154 (build-system gnu-build-system)
156 `(#:tests? #f ; No tests provided
158 (modify-phases %standard-phases
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)
170 (synopsis "Jump about directories")
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)))
178 (define-public envstore
185 (uri (string-append "https://finalrewind.org/projects/"
186 name "/" name "-" version ".tar.bz2"))
188 (base32 "1x97lxad80m5blhdfanl5v2qzjwcgbij2i23701bn8mpyxsrqszi"))))
189 (build-system gnu-build-system)
191 `(#:test-target "test"
192 #:make-flags (list "CC=gcc"
193 (string-append "PREFIX=" (assoc-ref %outputs "out")))
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)))
203 (define-public trash-cli
206 (version "0.17.1.14")
210 (uri (pypi-uri "trash-cli" version))
213 "01q0cl04ljf214z6s3g256gsxx3pqsgaf6ac1zh0vrq5bnhnr85h"))))
214 (build-system python-build-system)
217 #:tests? #f ; no tests
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"))
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")
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
237 (license license:gpl2+)))
239 (define-public direnv
244 (origin (method git-fetch)
246 (url "https://github.com/direnv/direnv")
247 (commit (string-append "v" version))))
248 (file-name (git-file-name name version))
251 "1y18619pmhfl0vrf4w0h75ybkkwgi9wcb7d9kv4n8drg1xp4aw4w"))))
252 (build-system go-build-system)
254 '(#:import-path "github.com/direnv/direnv"
256 (modify-phases %standard-phases
257 (add-after 'unpack 'delete-vendor
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")
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")))
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)))))
273 (lambda* (#:key tests? #:allow-other-keys)
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")))
286 `(("go-github-com-burntsushi-toml" ,go-github-com-burntsushi-toml)
287 ("go-github-com-direnv-go-dotenv" ,go-github-com-direnv-go-dotenv)
289 (home-page "https://direnv.net/")
290 (synopsis "Environment switcher for the shell")
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}.
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)))
309 (url "https://github.com/jhawthorn/fzy")
311 (file-name (git-file-name name version))
314 "1gkzdvj73f71388jvym47075l9zw61v6l8wdv2lnc0mns6dxig0k"))))
315 (build-system gnu-build-system)
317 '(#:make-flags (list "CC=gcc"
318 (string-append "PREFIX=" (assoc-ref %outputs "out")))
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
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.
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)))
343 (url "https://github.com/dvorka/hstr")
345 (file-name (git-file-name name version))
348 "1chmfdi1dwg3sarzd01nqa82g65q7wdr6hrnj96l75vikwsg986y"))))
349 (build-system gnu-build-system)
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")))
362 `(("autoconf" ,autoconf)
363 ("automake" ,automake)
364 ("pkg-config" ,pkg-config)))
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)))
379 (define-public shell-functools
381 (name "shell-functools")
386 (url "https://github.com/sharkdp/shell-functools")
387 (commit (string-append "v" version))))
388 (file-name (git-file-name name version))
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)))