diff options
Diffstat (limited to 'gnu/packages/shellutils.scm')
| -rw-r--r-- | gnu/packages/shellutils.scm | 54 |
1 files changed, 21 insertions, 33 deletions
diff --git a/gnu/packages/shellutils.scm b/gnu/packages/shellutils.scm index 43d7979700c..eceb879975f 100644 --- a/gnu/packages/shellutils.scm +++ b/gnu/packages/shellutils.scm | |||
| @@ -523,42 +523,30 @@ POSIX Shell}, @url{https://www.gnu.org/software/bash/, Bash}, and | |||
| 523 | (arguments | 523 | (arguments |
| 524 | (list | 524 | (list |
| 525 | #:install-source? #f | 525 | #:install-source? #f |
| 526 | #:modules | ||
| 527 | '((guix build cargo-build-system) | ||
| 528 | (guix build utils) | ||
| 529 | (ice-9 match)) | ||
| 526 | #:phases | 530 | #:phases |
| 527 | #~(modify-phases %standard-phases | 531 | #~(modify-phases %standard-phases |
| 528 | (add-after 'install 'install-completions | 532 | (add-after 'install 'install-completions |
| 529 | (lambda* (#:key native-inputs outputs #:allow-other-keys) | 533 | (lambda* (#:key native-inputs #:allow-other-keys) |
| 530 | (let* ((out (assoc-ref outputs "out")) | 534 | (for-each |
| 531 | (starship-bin | 535 | (match-lambda |
| 532 | (if #$(%current-target-system) | 536 | ((shell . path) |
| 533 | (search-input-file native-inputs "/bin/starship") | 537 | (mkdir-p (in-vicinity #$output (dirname path))) |
| 534 | (string-append out "/bin/starship"))) | 538 | (let ((binary |
| 535 | (share (string-append out "/share")) | 539 | (if #$(%current-target-system) |
| 536 | (bash-completion-dir | 540 | (search-input-file native-inputs "bin/starship") |
| 537 | (string-append out "/share/bash-completion/completions")) | 541 | (in-vicinity #$output "bin/starship")))) |
| 538 | (zsh-completion-dir | 542 | (with-output-to-file (in-vicinity #$output path) |
| 539 | (string-append share "/zsh/site-functions/")) | 543 | (lambda _ |
| 540 | (fish-completion-dir | 544 | (invoke binary "completions" shell)))))) |
| 541 | (string-append share "/fish/vendor_completions.d/")) | 545 | '(("bash" . "share/bash-completion/completions/starship") |
| 542 | (elvish-completion-dir | 546 | ("elvish" . "share/elvish/lib/starship") |
| 543 | (string-append share "/elvish/lib"))) | 547 | ("fish" . "share/fish/vendor_completions.d/starship.fish") |
| 544 | ;; Make the directories | 548 | ("nushell" . "share/nushell/vendor/autoload/starship") |
| 545 | (mkdir-p bash-completion-dir) | 549 | ("zsh" . "share/zsh/site-functions/_starship"))))) |
| 546 | (mkdir-p zsh-completion-dir) | ||
| 547 | (mkdir-p fish-completion-dir) | ||
| 548 | (mkdir-p elvish-completion-dir) | ||
| 549 | ;; Use the built starship to generate the completions. | ||
| 550 | (with-output-to-file | ||
| 551 | (string-append bash-completion-dir "/starship") | ||
| 552 | (lambda _ (invoke starship-bin "completions" "bash"))) | ||
| 553 | (with-output-to-file | ||
| 554 | (string-append zsh-completion-dir "/_starship") | ||
| 555 | (lambda _(invoke starship-bin "completions" "zsh"))) | ||
| 556 | (with-output-to-file | ||
| 557 | (string-append fish-completion-dir "/starship.fish") | ||
| 558 | (lambda _ (invoke starship-bin "completions" "fish"))) | ||
| 559 | (with-output-to-file | ||
| 560 | (string-append elvish-completion-dir "/starship") | ||
| 561 | (lambda _ (invoke starship-bin "completions" "elvish")))))) | ||
| 562 | ;; Some tests require a writable home directory | 550 | ;; Some tests require a writable home directory |
| 563 | (add-after 'unpack 'patch-test-shell | 551 | (add-after 'unpack 'patch-test-shell |
| 564 | (lambda* (#:key inputs #:allow-other-keys) | 552 | (lambda* (#:key inputs #:allow-other-keys) |
