guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

136/137: gnu: rbw: Install shell completions.


From: guix-commits
Subject: 136/137: gnu: rbw: Install shell completions.
Date: Thu, 21 Dec 2023 04:26:49 -0500 (EST)

efraim pushed a commit to branch rust-team
in repository guix.

commit 7cd6945833c57d9f665c4229ccfb4c3e47891880
Author: Efraim Flashner <efraim@flashner.co.il>
AuthorDate: Thu Dec 21 10:07:13 2023 +0200

    gnu: rbw: Install shell completions.
    
    * gnu/packages/rust-apps.scm (rbw)[arguments]: Add a phase to generate
    and install the shell completions.
    [native-inputs]: When cross-compiling add a copy of the package.
    
    Change-Id: Ibf8a1cc17470ecce479b8043678aedcf5556778e
---
 gnu/packages/rust-apps.scm | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/rust-apps.scm b/gnu/packages/rust-apps.scm
index 9b4e3fbeed..0be3b2b08d 100644
--- a/gnu/packages/rust-apps.scm
+++ b/gnu/packages/rust-apps.scm
@@ -2058,9 +2058,36 @@ runs a command whenever it detects modifications.")
         ("rust-totp-lite" ,rust-totp-lite-2)
         ("rust-url" ,rust-url-2)
         ("rust-uuid" ,rust-uuid-1)
-        ("rust-zeroize" ,rust-zeroize-1))))
+        ("rust-zeroize" ,rust-zeroize-1))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'install-completions
+           (lambda* (#:key native-inputs outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (share (string-append out "/share"))
+                    (rbw (if ,(%current-target-system)
+                          (search-input-file native-inputs "/bin/rbw")
+                          (string-append out "/bin/rbw"))))
+               (mkdir-p (string-append share "/bash-completion/completions"))
+               (with-output-to-file
+                 (string-append share "/bash-completion/completions/rbw")
+                 (lambda _ (invoke rbw "gen-completions" "bash")))
+               (mkdir-p (string-append share "/fish/vendor_completions.d"))
+               (with-output-to-file
+                 (string-append share "/fish/vendor_completions.d/rbw.fish")
+                 (lambda _ (invoke rbw "gen-completions" "fish")))
+               (mkdir-p (string-append share "/zsh/site-functions"))
+               (with-output-to-file
+                 (string-append share "/zsh/site-functions/_rbw")
+                 (lambda _ (invoke rbw "gen-completions" "zsh")))
+               (mkdir-p (string-append share "/elvish/lib"))
+               (with-output-to-file
+                 (string-append share "/elvish/lib/rbw")
+                 (lambda _ (invoke rbw "gen-completions" "elvish")))))))))
     (native-inputs
-     (list perl))
+     (cons* perl (if (%current-target-system)
+                   (list this-package)
+                   '())))
     (home-page "https://git.tozt.net/rbw";)
     (synopsis "Unofficial Bitwarden CLI")
     (description "This package is an unofficial command line client for



reply via email to

[Prev in Thread] Current Thread [Next in Thread]