Merge pull request #326922 from terlar/google-cloud-sdk-fish-completions

This commit is contained in:
Marcus Ramberg 2024-07-14 09:25:57 +03:00 committed by GitHub
commit 8a3aab0d46
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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 \