swiftlint: add shell completions support (#506815)
This commit is contained in:
@@ -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 ];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user