Merge pull request #262166 from wkral/leetcode-completions

leetcode-cli: Add shell completions
This commit is contained in:
Fabián Heredia Montiel 2023-10-19 21:50:03 -06:00 committed by GitHub
commit c3bb709fdb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@
, fetchCrate
, rustPlatform
, pkg-config
, installShellFiles
, openssl
, dbus
, sqlite
@ -24,6 +25,7 @@ rustPlatform.buildRustPackage rec {
nativeBuildInputs = [
pkg-config
installShellFiles
];
buildInputs = [
@ -32,6 +34,13 @@ rustPlatform.buildRustPackage rec {
sqlite
] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ];
postInstall = ''
installShellCompletion --cmd leetcode \
--bash <($out/bin/leetcode completions bash) \
--fish <($out/bin/leetcode completions fish) \
--zsh <($out/bin/leetcode completions zsh)
'';
passthru.tests = testers.testVersion {
package = leetcode-cli;
command = "leetcode -V";