Skip to content

Commit

Permalink
exercism: install shell completions
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kblcuk committed Dec 29, 2024
1 parent 4b7712c commit 3836664
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkgs/by-name/ex/exercism/package.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
lib,
buildGoModule,
installShellFiles,
fetchFromGitHub,
nix-update-script,
}:
Expand All @@ -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";
Expand Down

0 comments on commit 3836664

Please sign in to comment.