[bug#37364,1/1] gnu: Add z for zsh
diff mbox series

Message ID 87v9u03m3m.fsf@rekahsoft.ca
State New
Headers show
Series
  • Add z for zsh
Related show

Commit Message

Collin J. Doering Sept. 10, 2019, 2:45 a.m. UTC
* gnu/packages/shellutils.scm (z): New variable.

Signed-off-by: Collin J. Doering <collin@rekahsoft.ca>
---
 gnu/packages/shellutils.scm | 44 +++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

Comments

Ludovic Courtès Sept. 11, 2019, 12:23 p.m. UTC | #1
Hello Collin,

"Collin J. Doering" <collin@rekahsoft.ca> skribis:

> * gnu/packages/shellutils.scm (z): New variable.
>
> Signed-off-by: Collin J. Doering <collin@rekahsoft.ca>

[...]

> +(define-public z
> +  (package
> +    (name "z")

So far there’s only one package with a one-letter name.  I’d be tempted
to rename “z” to “sh-z” (because it works with both Zsh and Bash) or
something similar, WDYT?

> +               (mkdir-p man-path)
> +               (invoke "gzip" "z.1")
> +               (copy-file "z.1.gz" (string-append man-path "/z.1.gz"))

You can omit the “gzip” invocation because the ‘compress-documentation’
phase takes care of that, and passes the ‘-n’ flag, which is important
for bitwise reproducibility.

Also, you can remove the ‘mkdir-p’ call and replace the ‘copy-file’ call
with:

  (install-file "z.1" man)

Last: please remove ‘-path’ from variable names—in GNU the convention is
touse the term “path” only for search paths ($PATH, etc.)

> +    (synopsis "Jump about directories")
> +    (description
> +     "Tracks your most used directories, based on freecency.  After a short
> +learning phase, z will take you to the most frecent directory that matches
> +ALL of the regexes given on the command line in order.")

It’s suggest writing “``frecency''” (with quotes) to make it clear that
it’s not a typo.  :-)

Could you send an updated patch?

Thanks,
Ludo’.

Patch
diff mbox series

diff --git a/gnu/packages/shellutils.scm b/gnu/packages/shellutils.scm
index f7542ea759..f4e8e0fbdb 100644
--- a/gnu/packages/shellutils.scm
+++ b/gnu/packages/shellutils.scm
@@ -33,11 +33,55 @@ 
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages compression)
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system go)
   #:use-module (guix build-system python))
 
+(define-public z
+  (package
+    (name "z")
+    (version "1.11")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/rupa/z.git")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "13zbgkj6y0qhvn5jpkrqbd4jjxjr789k228iwma5hjfh1nx7ghyb"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("gzip" ,gzip)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (delete 'build)
+         (delete 'check)
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (man-path (string-append out "/share/man/man1"))
+                    (install-path (string-append out "/bin")))
+               (mkdir-p install-path)
+               (copy-file "z.sh" (string-append install-path "/z.sh"))
+               (chmod (string-append install-path "/z.sh") #o755)
+
+               (mkdir-p man-path)
+               (invoke "gzip" "z.1")
+               (copy-file "z.1.gz" (string-append man-path "/z.1.gz"))
+               (chmod (string-append man-path "/z.1.gz") #o744)))))))
+    (synopsis "Jump about directories")
+    (description
+     "Tracks your most used directories, based on freecency.  After a short
+learning phase, z will take you to the most frecent directory that matches
+ALL of the regexes given on the command line in order.")
+    (home-page "https://github.com/rupa/z")
+    (license license:expat)))
+
 (define-public envstore
   (package
     (name "envstore")