Merge pull request #316691 from superherointj/nodejs-add-bash-completion

nodejs: add bash shell completion
This commit is contained in:
superherointj 2024-06-04 17:54:14 -03:00 committed by GitHub
commit 60f8a6cf20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,6 +7,7 @@
, gnupg
, darwin, xcbuild
, procps, icu
, installShellFiles
}:
{ enableNpm ? true, version, sha256, patches ? [] } @args:
@ -69,7 +70,7 @@ let
buildInputs = lib.optionals stdenv.isDarwin [ CoreServices ApplicationServices ]
++ [ zlib libuv openssl http-parser icu bash ];
nativeBuildInputs = [ which pkg-config python ]
nativeBuildInputs = [ installShellFiles pkg-config python which ]
++ lib.optionals stdenv.isDarwin [ xcbuild ];
outputs = [ "out" "libv8" ];
@ -151,6 +152,11 @@ let
postInstall = ''
HOST_PATH=$out/bin patchShebangs --host $out
${lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
$out/bin/${self.meta.mainProgram} --completion-bash > ${self.meta.mainProgram}.bash
installShellCompletion ${self.meta.mainProgram}.bash
''}
${lib.optionalString (enableNpm) ''
mkdir -p $out/share/bash-completion/completions
ln -s $out/lib/node_modules/npm/lib/utils/completion.sh \