Unverified Commit a0fdbb94 authored by Yohann Boniface's avatar Yohann Boniface Committed by GitHub
Browse files

swiftlint: add shell completions support (#506815)

parents eedf76af 7f23d325
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
  lib,
  fetchurl,
  unzip,
  installShellFiles,
  nix-update-script,
  versionCheckHook,
}:
@@ -19,7 +20,10 @@ stdenvNoCC.mkDerivation rec {
  dontConfigure = true;
  dontBuild = true;

  nativeBuildInputs = [ unzip ];
  nativeBuildInputs = [
    unzip
    installShellFiles
  ];

  sourceRoot = ".";

@@ -29,6 +33,13 @@ stdenvNoCC.mkDerivation rec {
    runHook postInstall
  '';

  postInstall = lib.optionalString (stdenvNoCC.buildPlatform.canExecute stdenvNoCC.hostPlatform) ''
    installShellCompletion --cmd swiftlint \
      --bash <($out/bin/swiftlint --generate-completion-script bash) \
      --fish <($out/bin/swiftlint --generate-completion-script fish) \
      --zsh <($out/bin/swiftlint --generate-completion-script zsh)
  '';

  doInstallCheck = true;
  nativeInstallCheckInputs = [ versionCheckHook ];