google-cloud-sdk: fish completions

This commit is contained in:
Terje Larsen 2024-07-13 22:35:20 +02:00
parent 4e7b26b9d4
commit 06b93088f4
No known key found for this signature in database
GPG Key ID: DE147A553FC5AB4A

View File

@ -7,7 +7,7 @@
# 3) used by `google-cloud-sdk` only on GCE guests
#
{ stdenv, lib, fetchurl, makeWrapper, python, openssl, jq, callPackage, with-gce ? false }:
{ stdenv, lib, fetchurl, makeWrapper, python, openssl, jq, callPackage, installShellFiles, with-gce ? false }:
let
pythonEnv = python.withPackages (p: with p; [
@ -36,7 +36,7 @@ in stdenv.mkDerivation rec {
buildInputs = [ python ];
nativeBuildInputs = [ jq makeWrapper ];
nativeBuildInputs = [ jq makeWrapper installShellFiles ];
patches = [
# For kubectl configs, don't store the absolute path of the `gcloud` binary as it can be garbage-collected
@ -90,6 +90,12 @@ in stdenv.mkDerivation rec {
# zsh doesn't load completions from $FPATH without #compdef as the first line
sed -i '1 i #compdef gcloud' $out/share/zsh/site-functions/_gcloud
# setup fish completion
installShellCompletion --cmd gcloud \
--fish <(echo "complete -c gcloud -f -a '(__fish_argcomplete_complete gcloud)'")
installShellCompletion --cmd gsutil \
--fish <(echo "complete -c gsutil -f -a '(__fish_argcomplete_complete gsutil)'")
# This directory contains compiled mac binaries. We used crcmod from
# nixpkgs instead.
rm -r $out/google-cloud-sdk/platform/gsutil/third_party/crcmod \