summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2026-02-23 11:35:58 +0200
committerEfraim Flashner <efraim@flashner.co.il>2026-02-23 11:35:58 +0200
commit6f0395fd9b57e0fdb32187f0decc7e3f34d97cb3 (patch)
tree68ca95e71a2aa519ce237a46fa674e24cf4a46b1
parent94fb1eacc978a003f245d4795e6478f4df1d9a71 (diff)
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
-rw-r--r--gnu/packages/shellutils.scm37
1 files changed, 36 insertions, 1 deletions
diff --git a/gnu/packages/shellutils.scm b/gnu/packages/shellutils.scm
index 6fbd60ae2a9..17a4e4fa7de 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")