swift-format: add shell completions support (#506188)
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchpatch,
|
||||
callPackage,
|
||||
swift,
|
||||
swiftpm,
|
||||
swiftpm2nix,
|
||||
installShellFiles,
|
||||
Dispatch,
|
||||
Foundation,
|
||||
}:
|
||||
@@ -22,6 +22,7 @@ stdenv.mkDerivation {
|
||||
nativeBuildInputs = [
|
||||
swift
|
||||
swiftpm
|
||||
installShellFiles
|
||||
];
|
||||
buildInputs = [ Foundation ];
|
||||
|
||||
@@ -38,6 +39,16 @@ stdenv.mkDerivation {
|
||||
binPath="$(swiftpmBinPath)"
|
||||
mkdir -p $out/bin
|
||||
cp $binPath/swift-format $out/bin/
|
||||
|
||||
# Generate shell completions
|
||||
for shell in bash zsh fish; do
|
||||
$out/bin/swift-format --generate-completion-script $shell > swift-format.$shell
|
||||
done
|
||||
|
||||
installShellCompletion --cmd swift-format \
|
||||
--bash swift-format.bash \
|
||||
--zsh swift-format.zsh \
|
||||
--fish swift-format.fish
|
||||
'';
|
||||
|
||||
meta = {
|
||||
|
||||
Reference in New Issue
Block a user