guix_mirror_bot pushed a commit to branch master
in repository guix.

commit 6f0395fd9b57e0fdb32187f0decc7e3f34d97cb3
Author: Efraim Flashner <[email protected]>
AuthorDate: Mon Feb 23 11:35:58 2026 +0200

    gnu: pay-respects: Install shell completions.
    
    * gnu/packages/shellutils.scm (pay-respects)[arguments]: Add a phase to
    generate the shell completions.
    [native-inputs]: When cross-compiling add pay-respects.
    
    Change-Id: I150fd240283ae3b3994b5e8e6028ed7d6b359d9d
---
 gnu/packages/shellutils.scm | 37 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/shellutils.scm b/gnu/packages/shellutils.scm
index 6fbd60ae2a..17a4e4fa7d 100644
--- a/gnu/packages/shellutils.scm
+++ b/gnu/packages/shellutils.scm
@@ -1183,7 +1183,42 @@ shell with fzf, enabling fuzzy finding and 
multi-selection.")
        (sha256
         (base32 "0nmh5kkjhsrmhwlb09wvg6chzpl7w7xq1qr1yy9gc202yrv6cnmk"))))
     (build-system cargo-build-system)
-    (arguments (list #:install-source? #f))
+    (arguments
+     (list
+       #:install-source? #f
+       #:modules
+       '((guix build cargo-build-system)
+         (guix build utils)
+         (ice-9 match))
+       #:phases
+       #~(modify-phases %standard-phases
+           (add-after 'install 'install-completions
+            (lambda* (#:key native-inputs #:allow-other-keys)
+              (for-each
+               (match-lambda
+                 ((shell . path)
+                  (mkdir-p (in-vicinity #$output (dirname path)))
+                  (let ((binary
+                         (if #$(%current-target-system)
+                             (search-input-file native-inputs 
"bin/pay-respects")
+                             (in-vicinity #$output "bin/pay-respects"))))
+                    (with-output-to-file (in-vicinity #$output path)
+                      (lambda _
+                        (invoke binary shell)))
+                    ;; The shell completions call the binary so we make sure
+                    ;; that we call the correct binary.
+                    (when #$(%current-target-system)
+                      (substitute* (in-vicinity #$output path)
+                        (((search-input-file native-inputs "bin/pay-respects"))
+                         (in-vicinity #$output "bin/pay-respects")))))))
+               '(("bash"    . "share/bash-completion/completions/pay-respects")
+                 ("fish"    . 
"share/fish/vendor_completions.d/pay-respects.fish")
+                 ("nushell" . "share/nushell/vendor/autoload/pay-respects")
+                 ("zsh"     . "share/zsh/site-functions/_pay-respects"))))))))
+    (native-inputs
+     (if (%current-target-system)
+         (list this-package)
+         '()))
     (inputs (cargo-inputs 'pay-respects))
     (home-page "https://codeberg.org/iff/pay-respects";)
     (synopsis "Suggest correction for mistyped console commands")

Reply via email to