Merge pull request #303547 from pbek/feature/qownnotes-shell-completion

qownnotes: add shell completion
This commit is contained in:
rewine 2024-04-12 17:15:34 +08:00 committed by GitHub
commit ef65638082
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 13 additions and 2 deletions

View File

@ -14,6 +14,8 @@
, botan2
, pkg-config
, nixosTests
, installShellFiles
, xvfb-run
}:
let
@ -34,6 +36,8 @@ stdenv.mkDerivation {
qttools
wrapQtAppsHook
pkg-config
installShellFiles
xvfb-run
] ++ lib.optionals stdenv.isDarwin [ makeWrapper ];
buildInputs = [
@ -49,9 +53,16 @@ stdenv.mkDerivation {
"USE_SYSTEM_BOTAN=1"
];
postInstall =
postInstall = ''
installShellCompletion --cmd ${appname} \
--bash <(xvfb-run $out/bin/${appname} --completion bash --allow-multiple-instances) \
--fish <(xvfb-run $out/bin/${appname} --completion fish --allow-multiple-instances)
installShellCompletion --cmd ${pname} \
--bash <(xvfb-run $out/bin/${appname} --completion bash --allow-multiple-instances) \
--fish <(xvfb-run $out/bin/${appname} --completion fish --allow-multiple-instances)
''
# Create a lowercase symlink for Linux
lib.optionalString stdenv.isLinux ''
+ lib.optionalString stdenv.isLinux ''
ln -s $out/bin/${appname} $out/bin/${pname}
''
# Wrap application for macOS as lowercase binary