exercism: install shell completions

Exercism ships both with pre-generated completions [0], and has
`completion` command to generate completions for
bash/zsh/fish/powershell.
Initially I was planning to use the latter, but seems like due to
a bug (?) in cobra-generated completions (probably [1]), the resulting
completions aren't fully working (if at all);
so this makes use of the ones provided in the repo. I'll probably update
this once more to use auto-generated completions once I manage to update
cobra dependency for exercism CLI itself.

[0] https://github.com/exercism/cli/tree/main/shell
[1] https://github.com/spf13/cobra/pull/1940
This commit is contained in:
Alexei Mikhailov
2024-12-29 22:33:51 +02:00
parent 4b7712c3f1
commit 01f52b42e8
+10
View File
@@ -1,6 +1,7 @@
{
lib,
buildGoModule,
installShellFiles,
fetchFromGitHub,
nix-update-script,
}:
@@ -22,8 +23,17 @@ buildGoModule rec {
subPackages = [ "./exercism" ];
nativeBuildInputs = [ installShellFiles ];
passthru.updateScript = nix-update-script { };
postInstall = ''
installShellCompletion --cmd exercism \
--bash shell/exercism_completion.bash \
--fish shell/exercism.fish \
--zsh shell/exercism_completion.zsh
'';
meta = with lib; {
inherit (src.meta) homepage;
description = "Go based command line tool for exercism.io";