efraim pushed a commit to branch rust-team
in repository guix.
commit 6158c0f6a86e25fb1f5de73fd5ae3ed91a328481
Author: Efraim Flashner <[email protected]>
AuthorDate: Mon Dec 9 18:06:05 2024 +0200
gnu: procs: Build shell completions.
* gnu/packages/rust-apps.scm (procs)[arguments]: Add a phase to generate
and install the shell completions.
[native-inputs]: When cross-compiling add a copy of this package.
Change-Id: I7ac96dbed91b13ced7ca5d06e8456dd8cdf1b3b4
---
gnu/packages/rust-apps.scm | 41 +++++++++++++++++++++++++++++++++++++++--
1 file changed, 39 insertions(+), 2 deletions(-)
diff --git a/gnu/packages/rust-apps.scm b/gnu/packages/rust-apps.scm
index 590f616e50..abbb8a7f3b 100644
--- a/gnu/packages/rust-apps.scm
+++ b/gnu/packages/rust-apps.scm
@@ -2549,8 +2549,45 @@ rebase.")
"--doctype=manpage"
"--format=manpage"
"man/procs.1.adoc"
- (string-append "--destination-dir="
man))))))))
- (native-inputs (list asciidoc))
+ (string-append "--destination-dir=" man)))))
+ (add-after 'install 'install-shell-completions
+ (lambda* (#:key native-inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (share (string-append out "/share"))
+ (bash-completions-dir
+ (string-append out "/etc/bash_completion.d/"))
+ (zsh-completions-dir
+ (string-append share "/zsh/site-functions"))
+ (fish-completions-dir
+ (string-append share
"/fish/vendor_completions.d"))
+ (elvish-completions-dir
+ (string-append share "/elvish/lib"))
+ (procs (if #$(%current-target-system)
+ (search-input-file native-inputs
"/bin/procs")
+ (string-append out "/bin/procs"))))
+ (for-each mkdir-p
+ (list bash-completions-dir
+ zsh-completions-dir
+ fish-completions-dir
+ elvish-completions-dir))
+ (with-output-to-file
+ (string-append bash-completions-dir "/procs")
+ (lambda _ (invoke procs "--gen-completion-out"
"bash")))
+ (with-output-to-file
+ (string-append zsh-completions-dir "/_procs")
+ (lambda _ (invoke procs "--gen-completion-out"
"zsh")))
+ (with-output-to-file
+ (string-append fish-completions-dir "/procs.fish")
+ (lambda _ (invoke procs "--gen-completion-out"
"fish")))
+ (with-output-to-file
+ (string-append elvish-completions-dir "/procs")
+ (lambda _ (invoke procs "--gen-completion-out"
"elvish")))))))))
+ (native-inputs
+ (append
+ (if (%current-target-system)
+ (list this-package)
+ '())
+ (list asciidoc)))
(home-page "https://github.com/dalance/procs")
(synopsis "Modern replacement for @command{ps}")
(description "This package provides a modern replacement for @command{ps}