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>
11 ;;; This file is part of GNU Guix.
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26 (define-module (gnu packages shellutils)
27 #:use-module ((guix licenses) #:prefix license:)
28 #:use-module (guix utils)
29 #:use-module (guix packages)
30 #:use-module (guix download)
31 #:use-module (guix git-download)
32 #:use-module (guix build-system gnu)
33 #:use-module (guix build-system go)
34 #:use-module (guix build-system python)
35 #:use-module (gnu packages autotools)
36 #:use-module (gnu packages base)
37 #:use-module (gnu packages golang)
38 #:use-module (gnu packages ncurses)
39 #:use-module (gnu packages pkg-config)
40 #:use-module (gnu packages python)
41 #:use-module (gnu packages readline)
42 #:use-module (gnu packages ruby)
43 #:use-module (gnu packages shells)
44 #:use-module (gnu packages tmux))
46 (define-public zsh-autosuggestions
48 (name "zsh-autosuggestions")
53 (url "https://github.com/zsh-users/zsh-autosuggestions")
54 (commit (string-append "v" version))))
55 (file-name (git-file-name name version))
58 "0h52p2waggzfshvy1wvhj4hf06fmzd44bv6j18k3l9rcx6aixzn6"))))
59 (build-system gnu-build-system)
62 ("ruby-byebug" ,ruby-byebug)
63 ("ruby-pry" ,ruby-pry)
64 ("ruby-rspec" ,ruby-rspec)
65 ("ruby-rspec-wait" ,ruby-rspec-wait)
70 (modify-phases %standard-phases
72 (replace 'check ; Tests use ruby's bundler; instead execute rspec directly.
74 (setenv "TMUX_TMPDIR" (getenv "TMPDIR"))
75 (setenv "SHELL" (which "zsh"))
78 (lambda* (#:key outputs #:allow-other-keys)
79 (let* ((out (assoc-ref outputs "out"))
81 (string-append out "/share/zsh/plugins/zsh-autosuggestions")))
83 (install-file "zsh-autosuggestions.zsh" zsh-plugins)
85 (home-page "https://github.com/zsh-users/zsh-autosuggestions")
86 (synopsis "Fish-like autosuggestions for zsh")
88 "Fish-like fast/unobtrusive autosuggestions for zsh. It suggests commands
90 (license license:expat)))
99 (url "https://github.com/rupa/z")
100 (commit (string-append "v" version))))
101 (file-name (git-file-name name version))
104 "13zbgkj6y0qhvn5jpkrqbd4jjxjr789k228iwma5hjfh1nx7ghyb"))))
105 (build-system gnu-build-system)
107 `(#:tests? #f ; No tests provided
109 (modify-phases %standard-phases
113 (lambda* (#:key outputs #:allow-other-keys)
114 (let* ((out (assoc-ref outputs "out"))
115 (man (string-append out "/share/man/man1"))
116 (bin (string-append out "/bin")))
117 (install-file "z.sh" bin)
118 (chmod (string-append bin "/z.sh") #o755)
119 (install-file "z.1" man)
121 (synopsis "Jump about directories")
123 "Tracks your most used directories, based on ``frecency''. After a short
124 learning phase, z will take you to the most ``frecent'' directory that matches
125 all of the regexes given on the command line in order.")
126 (home-page "https://github.com/rupa/z")
127 (license license:expat)))
129 (define-public envstore
136 (uri (string-append "https://finalrewind.org/projects/"
137 name "/" name "-" version ".tar.bz2"))
139 (base32 "1x97lxad80m5blhdfanl5v2qzjwcgbij2i23701bn8mpyxsrqszi"))))
140 (build-system gnu-build-system)
142 `(#:test-target "test"
143 #:make-flags (list "CC=gcc"
144 (string-append "PREFIX=" (assoc-ref %outputs "out")))
146 (modify-phases %standard-phases
147 (delete 'configure))))
148 (home-page "https://finalrewind.org/projects/envstore/")
149 (synopsis "Save and restore environment variables")
150 (description "Envstore is a program for sharing environment variables
151 between various shells or commands.")
152 (license license:wtfpl2)))
154 (define-public trash-cli
157 (version "0.17.1.14")
161 (uri (pypi-uri "trash-cli" version))
164 "01q0cl04ljf214z6s3g256gsxx3pqsgaf6ac1zh0vrq5bnhnr85h"))))
165 (build-system python-build-system)
168 #:tests? #f ; no tests
170 (modify-phases %standard-phases
171 (add-before 'build 'patch-path-constants
172 (lambda* (#:key inputs #:allow-other-keys)
173 (let ((libc (assoc-ref inputs "libc"))
174 (coreutils (assoc-ref inputs "coreutils")))
175 (substitute* "trashcli/list_mount_points.py"
176 (("\"/lib/libc.so.6\".*")
177 (string-append "\"" libc "/lib/libc.so.6\"\n"))
179 (string-append "\"" coreutils "/bin/df\"")))))))))
180 (inputs `(("coreutils" ,coreutils)))
181 (home-page "https://github.com/andreafrancia/trash-cli")
182 (synopsis "Trash can management tool")
184 "trash-cli is a command line utility for interacting with the
185 FreeDesktop.org trash can used by GNOME, KDE, XFCE, and other common desktop
186 environments. It can move files to the trash, and remove or list files that
188 (license license:gpl2+)))
190 (define-public direnv
195 (origin (method git-fetch)
197 (url "https://github.com/direnv/direnv")
198 (commit (string-append "v" version))))
199 (file-name (git-file-name name version))
202 "1y18619pmhfl0vrf4w0h75ybkkwgi9wcb7d9kv4n8drg1xp4aw4w"))))
203 (build-system go-build-system)
205 '(#:import-path "github.com/direnv/direnv"
207 (modify-phases %standard-phases
208 (add-after 'unpack 'delete-vendor
210 ;; Using a snippet causes issues with the name of the directory,
211 ;; so delete the extra source code here.
212 (delete-file-recursively "src/github.com/direnv/direnv/vendor")
215 (lambda* (#:key tests? #:allow-other-keys)
217 (setenv "HOME" "/tmp")
218 (with-directory-excursion "src/github.com/direnv/direnv"
219 ;; The following file needs to be writable so it can be
220 ;; modified by the testsuite.
221 (make-file-writable "test/scenarios/base/.envrc")
222 (invoke "make" "test")
223 ;; Clean up from the tests, especially so that the extra
224 ;; direnv executable that's generated is removed.
225 (invoke "make" "clean")))
228 `(("go-github-com-burntsushi-toml" ,go-github-com-burntsushi-toml)
229 ("go-github-com-direnv-go-dotenv" ,go-github-com-direnv-go-dotenv)
231 (home-page "https://direnv.net/")
232 (synopsis "Environment switcher for the shell")
234 "direnv can hook into the bash, zsh, tcsh, and fish shells to load
235 or unload environment variables depending on the current directory. This
236 allows project-specific environment variables without using @file{~/.profile}.
238 Before each prompt, direnv checks for the existence of a @file{.envrc} file in
239 the current and parent directories. This file is then used to alter the
240 environment variables of the current shell.")
241 (license license:expat)))
251 (url "https://github.com/jhawthorn/fzy")
253 (file-name (git-file-name name version))
256 "1gkzdvj73f71388jvym47075l9zw61v6l8wdv2lnc0mns6dxig0k"))))
257 (build-system gnu-build-system)
259 '(#:make-flags (list "CC=gcc"
260 (string-append "PREFIX=" (assoc-ref %outputs "out")))
262 (modify-phases %standard-phases
263 (delete 'configure))))
264 (home-page "https://github.com/jhawthorn/fzy")
265 (synopsis "Fast fuzzy text selector for the terminal with an advanced
268 "Most other fuzzy matchers sort based on the length of a match. fzy tries
269 to find the result the user intended. It does this by favouring matches on
270 consecutive letters and starts of words. This allows matching using acronyms
271 or different parts of the path.
273 fzy is designed to be used both as an editor plugin and on the command
274 line. Rather than clearing the screen, fzy displays its interface directly
275 below the current cursor position, scrolling the screen if necessary.")
276 (license license:expat)))
285 (url "https://github.com/dvorka/hstr")
287 (file-name (git-file-name name version))
290 "1chmfdi1dwg3sarzd01nqa82g65q7wdr6hrnj96l75vikwsg986y"))))
291 (build-system gnu-build-system)
294 (modify-phases %standard-phases
295 (add-before 'build 'adjust-ncurses-includes
296 (lambda* (#:key make-flags outputs #:allow-other-keys)
297 (let ((out (assoc-ref outputs "out")))
298 (substitute* "src/include/hstr_curses.h"
299 (("ncursesw\\/curses.h") "ncurses.h"))
300 (substitute* "src/include/hstr.h"
301 (("ncursesw\\/curses.h") "ncurses.h")))
304 `(("autoconf" ,autoconf)
305 ("automake" ,automake)
306 ("pkg-config" ,pkg-config)))
308 `(("ncurses" ,ncurses)
309 ("readline" ,readline)))
310 (synopsis "Navigate and search command history with shell history suggest box")
311 (description "HSTR (HiSToRy) is a command-line utility that brings
312 improved Bash and Zsh command completion from the history. It aims to make
313 completion easier and more efficient than with @kbd{Ctrl-R}. It allows you to
314 easily view, navigate, and search your command history with suggestion boxes.
315 HSTR can also manage your command history (for instance you can remove
316 commands that are obsolete or contain a piece of sensitive information) or
317 bookmark your favourite commands.")
318 (home-page "http://me.mindforger.com/projects/hh.html")
319 (license license:asl2.0)))
321 (define-public shell-functools
323 (name "shell-functools")
328 (url "https://github.com/sharkdp/shell-functools")
329 (commit (string-append "v" version))))
330 (file-name (git-file-name name version))
333 "0d6zzg7cxfrzwzh1wmpj7q85kz33sak6ac59ncsm6dlbin12h0hi"))))
334 (build-system python-build-system)
335 (home-page "https://github.com/sharkdp/shell-functools/")
336 (synopsis "Functional programming tools for the shell")
337 (description "This package provides higher order functions like map,
338 filter, foldl, sort_by and take_while as simple command-line tools. Following
339 the UNIX philosophy, these commands are designed to be composed via pipes. A
340 large collection of functions such as basename, replace, contains or is_dir
341 are provided as arguments to these commands.")
342 (license license:expat)))