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 257b6ff commit 90af30d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkgs/by-name/ex/exercism/package.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
lib,
stdenv,
buildGoModule,
installShellFiles,
fetchFromGitHub,
nix-update-script,
}:
Expand All @@ -22,8 +24,17 @@ buildGoModule rec {

subPackages = [ "./exercism" ];

nativeBuildInputs = [ installShellFiles ];

passthru.updateScript = nix-update-script { };

postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
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 90af30d

Please sign in to comment.