From 1b524e736bc995ed6e4bb0b82ec60fd35bea05c9 Mon Sep 17 00:00:00 2001 From: Carl Kittelberger Date: Fri, 17 Jun 2022 12:26:26 +0200 Subject: [PATCH] Remove ZSH_GCLOUD_FIXES and make fixes permanent. --- home/dotfiles/zshrc | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/home/dotfiles/zshrc b/home/dotfiles/zshrc index 50d4ebe..aba2679 100644 --- a/home/dotfiles/zshrc +++ b/home/dotfiles/zshrc @@ -19,7 +19,6 @@ ZSH_ALIAS=${ZSH_ALIAS:-1} ZSH_COMPAT_BASH_COMPLETION=${ZSH_COMPAT_BASH_COMPLETION:-1} ZSH_CUSTOM=${ZSH_CUSTOM:-1} ZSH_DEFAULT_TERM=${ZSH_DEFAULT_TERM:-1} -ZSH_GCLOUD_FIXES=${ZSH_GCLOUD_FIXES:=$(when_binary_available gcloud)} ZSH_GPG_PINENTRY_FIX=${ZSH_GPG_PINENTRY_FIX:-1} ZSH_GPG_SSH_AGENT=${ZSH_GPG_SSH_AGENT:-$(has_binary gpgconf && [ -z "${SSH_AUTH_SOCK:-}" ] && [ -f $(gpgconf --list-dirs agent-ssh-socket) ] && printf 1 || printf 0)} ZSH_KEYBOARD=${ZSH_KEYBOARD:-1} @@ -179,28 +178,26 @@ section_end # gcloud fixes section "gcloud fixes" -if [ $ZSH_GCLOUD_FIXES -gt 0 ]; then - log "Overriding gcloud command" - _local_zshrc_ssh_config_needs_cleanup() { - [ ! -f ~/.ssh/config ] || grep -iq '^\s\+IdentityFile' ~/.ssh/config - } +log "Overriding gcloud command" +_local_zshrc_ssh_config_needs_cleanup() { + [ ! -f ~/.ssh/config ] || grep -iq '^\s\+IdentityFile' ~/.ssh/config +} - _local_zshrc_clean_up_ssh_config() { - if [ -f ~/.ssh/config ]; then - # avoid apps such as gcloud referencing their own SSH key, we have our own hardware-backed one, damn it! - sed -i -e 's/^\(\s\+\)IdentityFile/\1# Modified by ~\/.local_zshrc\n\1#IdentityFile/i' ~/.ssh/config - fi - } - - gcloud() { - command gcloud "$@" - } - - if has_binary gke-gcloud-auth-plugin; then - # avoid deprecation warning about gcloud auth by simply using the new plugin - log "Setting USE_GKE_GCLOUD_AUTH_PLUGIN=True to avoid deprecation warning" - USE_GKE_GCLOUD_AUTH_PLUGIN=True +_local_zshrc_clean_up_ssh_config() { + if [ -f ~/.ssh/config ]; then + # avoid apps such as gcloud referencing their own SSH key, we have our own hardware-backed one, damn it! + sed -i -e 's/^\(\s\+\)IdentityFile/\1# Modified by ~\/.local_zshrc\n\1#IdentityFile/i' ~/.ssh/config fi +} + +gcloud() { + command gcloud "$@" +} + +if has_binary gke-gcloud-auth-plugin; then + # avoid deprecation warning about gcloud auth by simply using the new plugin + log "Setting USE_GKE_GCLOUD_AUTH_PLUGIN=True to avoid deprecation warning" + USE_GKE_GCLOUD_AUTH_PLUGIN=True fi section_end