Subject: [bug#67919] [PATCH 55/55] gnu: eza: Refactor package definition.

From: Jaeme Sifat <[email-masked]>
Date: Tue, 19 Dec 2023 22:55:17 -0500

* gnu/packages/rust-apps.scm (eza): Refactor package definition.
[arguments]: Made 'install-extras phase clearer.

Change-Id: I4df0fdcde11d8ab07eed5aeeb1d14a6fe5fe55c3
---
 gnu/packages/rust-apps.scm | 45 ++++++++++++++++++++------------------
 1 file changed, 24 insertions(+), 21 deletions(-)

diff --git a/gnu/packages/rust-apps.scm b/gnu/packages/rust-apps.scm
index cf29cf051c..2f339f55d7 100644
--- a/gnu/packages/rust-apps.scm
+++ b/gnu/packages/rust-apps.scm
@@ -404,7 +404,6 @@ (define-public eza
       #:install-source? #f
       #:cargo-inputs
       `(("rust-ansiterm" ,rust-ansiterm-0.12)
-        ("rust-chrono" ,rust-chrono-0.4)
         ("rust-chrono" ,rust-chrono-0.4)
         ("rust-git2" ,rust-git2-0.18)
         ("rust-glob" ,rust-glob-0.3)
@@ -438,40 +437,44 @@ (define-public eza
                          (map (lambda (page)
                                 (with-output-to-file page
                                   (lambda _
-                                    (invoke "pandoc" "--standalone"
-                                            "-f" "markdown"
-                                            "-t" "man"
+                                    (invoke "pandoc"
+                                            "--standalone"
+                                            "-f"
+                                            "markdown"
+                                            "-t"
+                                            "man"
                                             (string-append "man/" page ".md")))))
                               (list "eza.1" "eza_colors.5")))))
                    (add-after 'install 'install-extras
                      (lambda* (#:key outputs #:allow-other-keys)
                        (let* ((out (assoc-ref outputs "out"))
                               (share (string-append out "/share"))
+                              (bash-completions-dir (string-append share
+                                                     "/bash-completion/completions"))
+                              (zsh-completions-dir (string-append share
+                                                    "/zsh/site-functions"))
+                              (fish-completions-dir (string-append share
+                                                     "/fish/vendor_completions.d"))
                               (man1 (string-append share "/man/man1"))
                               (man5 (string-append share "/man/man5")))
                          (when (file-exists? "eza.1")
                            (install-file "eza.1" man1))
                          (when (file-exists? "eza_colors.5")
                            (install-file "eza_colors.5" man5))
-                         (mkdir-p (string-append out "/etc/bash_completion.d"))
-                         (mkdir-p (string-append
-                                    share "/fish/vendor_completions.d"))
-                         (mkdir-p (string-append share "/zsh/site-functions"))
+                         (mkdir-p bash-completions-dir)
+                         (mkdir-p zsh-completions-dir)
+                         (mkdir-p fish-completions-dir)
                          (copy-file "completions/bash/eza"
-                                    (string-append
-                                      out "/etc/bash_completion.d/eza"))
-                         (copy-file "completions/fish/eza.fish"
-                                    (string-append
-                                      share "/fish/vendor_completions.d/eza.fish"))
+                                    (string-append bash-completions-dir "/eza"))
                          (copy-file "completions/zsh/_eza"
-                                    (string-append
-                                      share "/zsh/site-functions/_eza"))))))))
-    (native-inputs
-     (append
-       (list pkg-config)
-       (if (supported-package? pandoc)
-         (list pandoc)
-         '())))
+                                    (string-append zsh-completions-dir "/_eza"))
+                         (copy-file "completions/fish/eza.fish"
+                                    (string-append fish-completions-dir
+                                                   "/eza.fish"))))))))
+    (native-inputs (append (list pkg-config)
+                           (if (supported-package? pandoc)
+                               (list pandoc)
+                               '())))
     (inputs (list libgit2-1.7 zlib))
     (home-page "https://github.com/eza-community/eza")
     (synopsis "Modern replacement for ls")
-- 
2.41.0