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 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2018 Benjamin Slade <slade@jnanam.net>
8 ;;; Copyright © 2019 Collin J. Doering <collin@rekahsoft.ca>
10 ;;; This file is part of GNU Guix.
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25 (define-module (gnu packages shellutils)
26 #:use-module ((guix licenses) #:prefix license:)
27 #:use-module (guix utils)
28 #:use-module (guix packages)
29 #:use-module (guix download)
30 #:use-module (guix git-download)
31 #:use-module (guix build-system gnu)
32 #:use-module (guix build-system go)
33 #:use-module (guix build-system python)
34 #:use-module (gnu packages autotools)
35 #:use-module (gnu packages base)
36 #:use-module (gnu packages golang)
37 #:use-module (gnu packages ncurses)
38 #:use-module (gnu packages pkg-config)
39 #:use-module (gnu packages python)
40 #:use-module (gnu packages readline)
41 #:use-module (gnu packages ruby)
42 #:use-module (gnu packages shells)
43 #:use-module (gnu packages tmux))
45 (define-public zsh-autosuggestions
47 (name "zsh-autosuggestions")
52 (url "https://github.com/zsh-users/zsh-autosuggestions.git")
53 (commit (string-append "v" version))))
54 (file-name (git-file-name name version))
57 "1h8h2mz9wpjpymgl2p7pc146c1jgb3dggpvzwm9ln3in336wl95c"))))
58 (build-system gnu-build-system)
61 ("ruby-byebug" ,ruby-byebug)
62 ("ruby-pry" ,ruby-pry)
63 ("ruby-rspec" ,ruby-rspec)
64 ("ruby-rspec-wait" ,ruby-rspec-wait)
69 (modify-phases %standard-phases
71 (replace 'check ; Tests use ruby's bundler; instead execute rspec directly.
73 (setenv "TMUX_TMPDIR" (getenv "TMPDIR"))
74 (setenv "SHELL" (which "zsh"))
77 (lambda* (#:key outputs #:allow-other-keys)
78 (let* ((out (assoc-ref outputs "out"))
80 (string-append out "/share/zsh/plugins/zsh-autosuggestions")))
82 (install-file "zsh-autosuggestions.zsh" zsh-plugins)
84 (home-page "https://github.com/zsh-users/zsh-autosuggestions")
85 (synopsis "Fish-like autosuggestions for zsh")
87 "Fish-like fast/unobtrusive autosuggestions for zsh. It suggests commands
89 (license license:expat)))
98 (url "https://github.com/rupa/z.git")
99 (commit (string-append "v" version))))
100 (file-name (git-file-name name version))
103 "13zbgkj6y0qhvn5jpkrqbd4jjxjr789k228iwma5hjfh1nx7ghyb"))))
104 (build-system gnu-build-system)
106 `(#:tests? #f ; No tests provided
108 (modify-phases %standard-phases
112 (lambda* (#:key outputs #:allow-other-keys)
113 (let* ((out (assoc-ref outputs "out"))
114 (man (string-append out "/share/man/man1"))
115 (bin (string-append out "/bin")))
116 (install-file "z.sh" bin)
117 (chmod (string-append bin "/z.sh") #o755)
118 (install-file "z.1" man)
120 (synopsis "Jump about directories")
122 "Tracks your most used directories, based on ``frecency''. After a short
123 learning phase, z will take you to the most ``frecent'' directory that matches
124 all of the regexes given on the command line in order.")
125 (home-page "https://github.com/rupa/z")
126 (license license:expat)))
128 (define-public envstore
135 (uri (string-append "https://finalrewind.org/projects/"
136 name "/" name "-" version ".tar.bz2"))
138 (base32 "1x97lxad80m5blhdfanl5v2qzjwcgbij2i23701bn8mpyxsrqszi"))))
139 (build-system gnu-build-system)
141 `(#:test-target "test"
142 #:make-flags (list "CC=gcc"
143 (string-append "PREFIX=" (assoc-ref %outputs "out")))
145 (modify-phases %standard-phases
146 (delete 'configure))))
147 (home-page "https://finalrewind.org/projects/envstore/")
148 (synopsis "Save and restore environment variables")
149 (description "Envstore is a program for sharing environment variables
150 between various shells or commands.")
151 (license license:wtfpl2)))
153 (define-public trash-cli
156 (version "0.17.1.14")
160 (uri (pypi-uri "trash-cli" version))
163 "01q0cl04ljf214z6s3g256gsxx3pqsgaf6ac1zh0vrq5bnhnr85h"))))
164 (build-system python-build-system)
167 #:tests? #f ; no tests
169 (modify-phases %standard-phases
170 (add-before 'build 'patch-path-constants
171 (lambda* (#:key inputs #:allow-other-keys)
172 (let ((libc (assoc-ref inputs "libc"))
173 (coreutils (assoc-ref inputs "coreutils")))
174 (substitute* "trashcli/list_mount_points.py"
175 (("\"/lib/libc.so.6\".*")
176 (string-append "\"" libc "/lib/libc.so.6\"\n"))
178 (string-append "\"" coreutils "/bin/df\"")))))))))
179 (inputs `(("coreutils" ,coreutils)))
180 (home-page "https://github.com/andreafrancia/trash-cli")
181 (synopsis "Trash can management tool")
183 "trash-cli is a command line utility for interacting with the
184 FreeDesktop.org trash can used by GNOME, KDE, XFCE, and other common desktop
185 environments. It can move files to the trash, and remove or list files that
187 (license license:gpl2+)))
189 (define-public direnv
194 (origin (method git-fetch)
196 (url "https://github.com/direnv/direnv.git")
197 (commit (string-append "v" version))))
198 (file-name (git-file-name name version))
201 "1y18619pmhfl0vrf4w0h75ybkkwgi9wcb7d9kv4n8drg1xp4aw4w"))))
202 (build-system go-build-system)
204 '(#:import-path "github.com/direnv/direnv"
206 (modify-phases %standard-phases
207 (add-after 'unpack 'delete-vendor
209 ;; Using a snippet causes issues with the name of the directory,
210 ;; so delete the extra source code here.
211 (delete-file-recursively "src/github.com/direnv/direnv/vendor")
214 (lambda* (#:key tests? #:allow-other-keys)
216 (setenv "HOME" "/tmp")
217 (with-directory-excursion "src/github.com/direnv/direnv"
218 ;; The following file needs to be writable so it can be
219 ;; modified by the testsuite.
220 (make-file-writable "test/scenarios/base/.envrc")
221 (invoke "make" "test")
222 ;; Clean up from the tests, especially so that the extra
223 ;; direnv executable that's generated is removed.
224 (invoke "make" "clean")))
227 `(("go-github-com-burntsushi-toml" ,go-github-com-burntsushi-toml)
228 ("go-github-com-direnv-go-dotenv" ,go-github-com-direnv-go-dotenv)
230 (home-page "https://direnv.net/")
231 (synopsis "Environment switcher for the shell")
233 "direnv can hook into the bash, zsh, tcsh, and fish shells to load
234 or unload environment variables depending on the current directory. This
235 allows project-specific environment variables without using @file{~/.profile}.
237 Before each prompt, direnv checks for the existence of a @file{.envrc} file in
238 the current and parent directories. This file is then used to alter the
239 environment variables of the current shell.")
240 (license license:expat)))
250 (url "https://github.com/jhawthorn/fzy.git")
252 (file-name (git-file-name name version))
255 "1gkzdvj73f71388jvym47075l9zw61v6l8wdv2lnc0mns6dxig0k"))))
256 (build-system gnu-build-system)
258 '(#:make-flags (list "CC=gcc"
259 (string-append "PREFIX=" (assoc-ref %outputs "out")))
261 (modify-phases %standard-phases
262 (delete 'configure))))
263 (home-page "https://github.com/jhawthorn/fzy")
264 (synopsis "Fast fuzzy text selector for the terminal with an advanced
267 "Most other fuzzy matchers sort based on the length of a match. fzy tries
268 to find the result the user intended. It does this by favouring matches on
269 consecutive letters and starts of words. This allows matching using acronyms
270 or different parts of the path.
272 fzy is designed to be used both as an editor plugin and on the command
273 line. Rather than clearing the screen, fzy displays its interface directly
274 below the current cursor position, scrolling the screen if necessary.")
275 (license license:expat)))
284 (url "https://github.com/dvorka/hstr.git")
286 (file-name (git-file-name name version))
289 "1y9vsfbg07gbic0daqy569d9pb9i1d07fym3q7a0a99hbng85s20"))))
290 (build-system gnu-build-system)
293 (modify-phases %standard-phases
294 (add-before 'build 'adjust-ncurses-includes
295 (lambda* (#:key make-flags outputs #:allow-other-keys)
296 (let ((out (assoc-ref outputs "out")))
297 (substitute* "src/include/hstr_curses.h"
298 (("ncursesw\\/curses.h") "ncurses.h"))
299 (substitute* "src/include/hstr.h"
300 (("ncursesw\\/curses.h") "ncurses.h")))
303 `(("autoconf" ,autoconf)
304 ("automake" ,automake)
305 ("pkg-config" ,pkg-config)))
307 `(("ncurses" ,ncurses)
308 ("readline" ,readline)))
309 (synopsis "Navigate and search command history with shell history suggest box")
310 (description "HSTR (HiSToRy) is a command-line utility that brings
311 improved Bash and Zsh command completion from the history. It aims to make
312 completion easier and more efficient than with @kbd{Ctrl-R}. It allows you to
313 easily view, navigate, and search your command history with suggestion boxes.
314 HSTR can also manage your command history (for instance you can remove
315 commands that are obsolete or contain a piece of sensitive information) or
316 bookmark your favourite commands.")
317 (home-page "http://me.mindforger.com/projects/hh.html")
318 (license license:asl2.0)))
320 (define-public shell-functools
322 (name "shell-functools")
327 (url "https://github.com/sharkdp/shell-functools.git")
328 (commit (string-append "v" version))))
329 (file-name (git-file-name name version))
332 "0d6zzg7cxfrzwzh1wmpj7q85kz33sak6ac59ncsm6dlbin12h0hi"))))
333 (build-system python-build-system)
334 (home-page "https://github.com/sharkdp/shell-functools/")
335 (synopsis "Functional programming tools for the shell")
336 (description "This package provides higher order functions like map,
337 filter, foldl, sort_by and take_while as simple command-line tools. Following
338 the UNIX philosophy, these commands are designed to be composed via pipes. A
339 large collection of functions such as basename, replace, contains or is_dir
340 are provided as arguments to these commands.")
341 (license license:expat)))