aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2022-10-01 23:46:12 +0300
committerEfraim Flashner <efraim@flashner.co.il>2022-10-01 23:46:12 +0300
commit4b5ac6b226bdf34387ded002647c44a0c63587f8 (patch)
tree484ef7da7dcbeee41a093f3a8754a640d1fba03e
parent461b1e490935e720999e78dc29656ae3c9ea2ea3 (diff)
downloadguix-4b5ac6b226bdf34387ded002647c44a0c63587f8.tar
guix-4b5ac6b226bdf34387ded002647c44a0c63587f8.tar.gz
gnu: exercism: Install shell completions.
* gnu/packages/education.scm (exercism)[arguments]: Add a phase to build and install shell completions.
-rw-r--r--gnu/packages/education.scm23
1 files changed, 22 insertions, 1 deletions
diff --git a/gnu/packages/education.scm b/gnu/packages/education.scm
index a2607087e5..f16324a2c6 100644
--- a/gnu/packages/education.scm
+++ b/gnu/packages/education.scm
@@ -1065,7 +1065,28 @@ machine, and more.")
(arguments
`(#:import-path "github.com/exercism/cli/exercism"
#:unpack-path "github.com/exercism/cli"
- #:install-source? #f))
+ #:install-source? #f
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'install 'install-completions
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (bash (string-append out "/etc/bash_completion.d/exercism"))
+ (fish (string-append
+ out "/share/fish/vendor_completions.d/exercism.fish"))
+ (zsh (string-append out "/share/zsh/site-functions/_exercism")))
+ (mkdir-p (dirname bash))
+ (with-output-to-file bash
+ (lambda ()
+ (invoke (string-append out "/bin/exercism") "completion" "bash")))
+ (mkdir-p (dirname fish))
+ (with-output-to-file fish
+ (lambda ()
+ (invoke (string-append out "/bin/exercism") "completion" "fish")))
+ (mkdir-p (dirname zsh))
+ (with-output-to-file zsh
+ (lambda ()
+ (invoke (string-append out "/bin/exercism") "completion" "zsh")))))))))
(inputs
`(("github.com/blang/semver" ,go-github-com-blang-semver)
("github.com/spf13/cobra" ,go-github-com-spf13-cobra)