Subject: [PATCH v2 6/6] gnu: starship: Fix shell completion directories.

From: Efraim Flashner <[email-masked]>
Date: Thu, 27 Mar 2025 10:46:45 +0200

From: 45mg <[email-masked]>

* gnu/packages/shellutils.scm (starship) [arguments]: Use the shell
completion directory variables.

Change-Id: Ie286218d636a56745013ebdb23461691fdf16d11
---
 gnu/packages/shellutils.scm | 27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/gnu/packages/shellutils.scm b/gnu/packages/shellutils.scm
index 28c8af8685a..c7723cb2e04 100644
--- a/gnu/packages/shellutils.scm
+++ b/gnu/packages/shellutils.scm
@@ -496,33 +496,24 @@ (define-public starship
                      (starship-bin
                        (if #$(%current-target-system)
                            (search-input-file native-inputs "/bin/starship")
-                           (string-append out "/bin/starship")))
-                     (share (string-append out "/share"))
-                     (bash-completion-dir
-                       (string-append out "/etc/bash-completion.d/"))
-                     (zsh-completion-dir
-                       (string-append share "/zsh/site-functions/"))
-                     (fish-completion-dir
-                       (string-append share "/fish/vendor_completions.d/"))
-                     (elvish-completion-dir
-                       (string-append share "/elvish/lib")))
+                           (string-append out "/bin/starship"))))
                     ;; Make the directories
-                  (mkdir-p bash-completion-dir)
-                  (mkdir-p zsh-completion-dir)
-                  (mkdir-p fish-completion-dir)
-                  (mkdir-p elvish-completion-dir)
+                  (mkdir-p (string-append out #$bash-completion-dir))
+                  (mkdir-p (string-append out #$zsh-completion-dir))
+                  (mkdir-p (string-append out #$fish-completion-dir))
+                  (mkdir-p (string-append out #$elvish-completion-dir))
                   ;; Use the built starship to generate the completions.
                   (with-output-to-file
-                    (string-append bash-completion-dir "/starship")
+                    (string-append out #$bash-completion-dir "/starship")
                     (lambda _ (invoke starship-bin "completions" "bash")))
                   (with-output-to-file
-                    (string-append zsh-completion-dir "/_starship")
+                    (string-append out #$zsh-completion-dir "/_starship")
                     (lambda _(invoke starship-bin "completions" "zsh")))
                   (with-output-to-file
-                    (string-append fish-completion-dir "/starship.fish")
+                    (string-append out #$fish-completion-dir "/starship.fish")
                     (lambda _ (invoke starship-bin "completions" "fish")))
                   (with-output-to-file
-                    (string-append elvish-completion-dir "/starship")
+                    (string-append out #$elvish-completion-dir "/starship")
                     (lambda _ (invoke starship-bin "completions" "elvish"))))))
           ;; Some tests require a writable home directory
           (add-after 'unpack 'patch-test-shell
-- 
Efraim Flashner   <[email-masked]>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted