Unverified Commit 677347a5 authored by tomberek's avatar tomberek Committed by GitHub
Browse files

cobra-cli: install shell completions for bash, zsh, and fish (#438840)

parents b6df6797 e9951f32
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
  buildGoModule,
  fetchFromGitHub,
  makeWrapper,
  installShellFiles,
  go,
}:

@@ -19,7 +20,10 @@ buildGoModule rec {

  vendorHash = "sha256-vrtGPQzY+NImOGaSxV+Dvch+GNPfL9XfY4lfCHTGXwY=";

  nativeBuildInputs = [ makeWrapper ];
  nativeBuildInputs = [
    makeWrapper
    installShellFiles
  ];

  allowGoReference = true;

@@ -35,6 +39,13 @@ buildGoModule rec {
      --prefix PATH : ${go}/bin
  '';

  postInstall = ''
    installShellCompletion --cmd cobra-cli \
      --bash <($out/bin/cobra-cli completion bash) \
      --fish <($out/bin/cobra-cli completion fish) \
      --zsh <($out/bin/cobra-cli completion zsh) \
  '';

  meta = {
    description = "Cobra CLI tool to generate applications and commands";
    mainProgram = "cobra-cli";