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>
12 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
56 (url "https://github.com/ascii-boxes/boxes")
57 (commit (string-append "v" version))))
58 (file-name (git-file-name name version))
61 "0b12rsynrmkldlwcb62drk33kk0aqwbj10mq5y5x3hjf626gjwsi"))))
62 (build-system gnu-build-system)
64 `(#:test-target "test"
65 #:make-flags (list (string-append "GLOBALCONF="
66 (assoc-ref %outputs "out")
69 (modify-phases %standard-phases
72 (lambda* (#:key outputs #:allow-other-keys)
73 (let ((dest (assoc-ref outputs "out")))
76 (string-append dest "/" (cdr x))))
77 '(("src/boxes" . "bin")
78 ("doc/boxes.1" . "share/man/man1")
79 ("boxes-config" . "etc/")))
81 (native-inputs `(("flex" ,flex) ("bison" ,bison)))
82 (synopsis "Command line ASCII boxes")
84 "This command-line filter program draws ASCII-art boxes around your input
86 (home-page "https://boxes.thomasjensen.com/build.html")
87 (license license:gpl2)))
89 (define-public zsh-autosuggestions
91 (name "zsh-autosuggestions")
96 (url "https://github.com/zsh-users/zsh-autosuggestions")
97 (commit (string-append "v" version))))
98 (file-name (git-file-name name version))
101 "0h52p2waggzfshvy1wvhj4hf06fmzd44bv6j18k3l9rcx6aixzn6"))))
102 (build-system gnu-build-system)
105 ("ruby-byebug" ,ruby-byebug)
106 ("ruby-pry" ,ruby-pry)
107 ("ruby-rspec" ,ruby-rspec)
108 ("ruby-rspec-wait" ,ruby-rspec-wait)
113 (modify-phases %standard-phases
115 (replace 'check ; Tests use ruby's bundler; instead execute rspec directly.
117 (setenv "TMUX_TMPDIR" (getenv "TMPDIR"))
118 (setenv "SHELL" (which "zsh"))
121 (lambda* (#:key outputs #:allow-other-keys)
122 (let* ((out (assoc-ref outputs "out"))
124 (string-append out "/share/zsh/plugins/zsh-autosuggestions")))
125 (invoke "make" "all")
126 (install-file "zsh-autosuggestions.zsh" zsh-plugins)
128 (home-page "https://github.com/zsh-users/zsh-autosuggestions")
129 (synopsis "Fish-like autosuggestions for zsh")
131 "Fish-like fast/unobtrusive autosuggestions for zsh. It suggests commands
133 (license license:expat)))
142 (url "https://github.com/rupa/z")
143 (commit (string-append "v" version))))
144 (file-name (git-file-name name version))
147 "13zbgkj6y0qhvn5jpkrqbd4jjxjr789k228iwma5hjfh1nx7ghyb"))))
148 (build-system gnu-build-system)
150 `(#:tests? #f ; No tests provided
152 (modify-phases %standard-phases
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)
164 (synopsis "Jump about directories")
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)))
172 (define-public envstore
179 (uri (string-append "https://finalrewind.org/projects/"
180 name "/" name "-" version ".tar.bz2"))
182 (base32 "1x97lxad80m5blhdfanl5v2qzjwcgbij2i23701bn8mpyxsrqszi"))))
183 (build-system gnu-build-system)
185 `(#:test-target "test"
186 #:make-flags (list "CC=gcc"
187 (string-append "PREFIX=" (assoc-ref %outputs "out")))
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)))
197 (define-public trash-cli
200 (version "0.17.1.14")
204 (uri (pypi-uri "trash-cli" version))
207 "01q0cl04ljf214z6s3g256gsxx3pqsgaf6ac1zh0vrq5bnhnr85h"))))
208 (build-system python-build-system)
211 #:tests? #f ; no tests
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"))
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")
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
231 (license license:gpl2+)))
233 (define-public direnv
238 (origin (method git-fetch)
240 (url "https://github.com/direnv/direnv")
241 (commit (string-append "v" version))))
242 (file-name (git-file-name name version))
245 "1y18619pmhfl0vrf4w0h75ybkkwgi9wcb7d9kv4n8drg1xp4aw4w"))))
246 (build-system go-build-system)
248 '(#:import-path "github.com/direnv/direnv"
250 (modify-phases %standard-phases
251 (add-after 'unpack 'delete-vendor
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")
258 (lambda* (#:key tests? #:allow-other-keys)
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")))
271 `(("go-github-com-burntsushi-toml" ,go-github-com-burntsushi-toml)
272 ("go-github-com-direnv-go-dotenv" ,go-github-com-direnv-go-dotenv)
274 (home-page "https://direnv.net/")
275 (synopsis "Environment switcher for the shell")
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}.
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)))
294 (url "https://github.com/jhawthorn/fzy")
296 (file-name (git-file-name name version))
299 "1gkzdvj73f71388jvym47075l9zw61v6l8wdv2lnc0mns6dxig0k"))))
300 (build-system gnu-build-system)
302 '(#:make-flags (list "CC=gcc"
303 (string-append "PREFIX=" (assoc-ref %outputs "out")))
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
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.
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)))
328 (url "https://github.com/dvorka/hstr")
330 (file-name (git-file-name name version))
333 "1chmfdi1dwg3sarzd01nqa82g65q7wdr6hrnj96l75vikwsg986y"))))
334 (build-system gnu-build-system)
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")))
347 `(("autoconf" ,autoconf)
348 ("automake" ,automake)
349 ("pkg-config" ,pkg-config)))
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)))
364 (define-public shell-functools
366 (name "shell-functools")
371 (url "https://github.com/sharkdp/shell-functools")
372 (commit (string-append "v" version))))
373 (file-name (git-file-name name version))
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)))