Skip to content

Commit 3836664

Browse files
committed
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] spf13/cobra#1940
1 parent 4b7712c commit 3836664

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pkgs/by-name/ex/exercism/package.nix

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
lib,
33
buildGoModule,
4+
installShellFiles,
45
fetchFromGitHub,
56
nix-update-script,
67
}:
@@ -22,8 +23,17 @@ buildGoModule rec {
2223

2324
subPackages = [ "./exercism" ];
2425

26+
nativeBuildInputs = [ installShellFiles ];
27+
2528
passthru.updateScript = nix-update-script { };
2629

30+
postInstall = ''
31+
installShellCompletion --cmd exercism \
32+
--bash < shell/exercism_completion.bash \
33+
--fish < shell/exercism.fish \
34+
--zsh < shell/exercism_completion.zsh
35+
'';
36+
2737
meta = with lib; {
2838
inherit (src.meta) homepage;
2939
description = "Go based command line tool for exercism.io";

0 commit comments

Comments
 (0)