taplo: add shell completions (#441089)
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
{
|
||||
stdenv,
|
||||
lib,
|
||||
rustPlatform,
|
||||
fetchCrate,
|
||||
pkg-config,
|
||||
openssl,
|
||||
withLsp ? true,
|
||||
installShellFiles,
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
@@ -20,6 +22,7 @@ rustPlatform.buildRustPackage rec {
|
||||
cargoHash = "sha256-tvijtB5fwOzQnnK/ClIvTbjCcMeqZpXcRdWWKZPIulM=";
|
||||
|
||||
nativeBuildInputs = [
|
||||
installShellFiles
|
||||
pkg-config
|
||||
];
|
||||
|
||||
@@ -29,6 +32,21 @@ rustPlatform.buildRustPackage rec {
|
||||
|
||||
buildFeatures = lib.optional withLsp "lsp";
|
||||
|
||||
postInstall =
|
||||
lib.optionalString
|
||||
(
|
||||
stdenv.buildPlatform.canExecute stdenv.hostPlatform
|
||||
&&
|
||||
# Creation of the completions fails on Darwin platforms.
|
||||
!stdenv.hostPlatform.isDarwin
|
||||
)
|
||||
''
|
||||
installShellCompletion --cmd taplo \
|
||||
--bash <($out/bin/taplo completions bash) \
|
||||
--fish <($out/bin/taplo completions fish) \
|
||||
--zsh <($out/bin/taplo completions zsh)
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "TOML toolkit written in Rust";
|
||||
homepage = "https://taplo.tamasfe.dev";
|
||||
|
||||
Reference in New Issue
Block a user