Merge pull request #267061 from nix-julia/add-shell-completions-mdbook

mdbook: add shell completions

Changed files
+10 -1
pkgs
tools
text
mdbook
+10 -1
pkgs/tools/text/mdbook/default.nix
···
-
{ lib, stdenv, fetchFromGitHub, nix, rustPlatform, CoreServices }:
rustPlatform.buildRustPackage rec {
pname = "mdbook";
···
cargoHash = "sha256-D0XhrweO0A1+81Je4JZ0lmnbIHstNvefpmogCyB4FEE=";
buildInputs = lib.optionals stdenv.isDarwin [ CoreServices ];
passthru = {
tests = {
···
+
{ lib, stdenv, fetchFromGitHub, nix, rustPlatform, CoreServices, installShellFiles }:
rustPlatform.buildRustPackage rec {
pname = "mdbook";
···
cargoHash = "sha256-D0XhrweO0A1+81Je4JZ0lmnbIHstNvefpmogCyB4FEE=";
+
nativeBuildInputs = [ installShellFiles ];
+
buildInputs = lib.optionals stdenv.isDarwin [ CoreServices ];
+
+
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
+
installShellCompletion --cmd mdbook \
+
--bash <($out/bin/mdbook completions bash) \
+
--fish <($out/bin/mdbook completions fish) \
+
--zsh <($out/bin/mdbook completions zsh )
+
'';
passthru = {
tests = {