Compare commits

..

2 Commits

Author SHA1 Message Date
Icedream 757dbc6ae3
Enable automatic .ssh/config cleanup. 2022-06-17 12:29:10 +02:00
Icedream 80e5bb5a1f
Revert "Remove ZSH_GCLOUD_FIXES and make fixes permanent."
This reverts commit 1b524e736b.
2022-06-17 12:28:44 +02:00
1 changed files with 24 additions and 18 deletions

View File

@ -19,6 +19,7 @@ ZSH_ALIAS=${ZSH_ALIAS:-1}
ZSH_COMPAT_BASH_COMPLETION=${ZSH_COMPAT_BASH_COMPLETION:-1} ZSH_COMPAT_BASH_COMPLETION=${ZSH_COMPAT_BASH_COMPLETION:-1}
ZSH_CUSTOM=${ZSH_CUSTOM:-1} ZSH_CUSTOM=${ZSH_CUSTOM:-1}
ZSH_DEFAULT_TERM=${ZSH_DEFAULT_TERM:-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_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_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} ZSH_KEYBOARD=${ZSH_KEYBOARD:-1}
@ -178,6 +179,7 @@ section_end
# gcloud fixes # gcloud fixes
section "gcloud fixes" section "gcloud fixes"
if [ $ZSH_GCLOUD_FIXES -gt 0 ]; then
log "Overriding gcloud command" log "Overriding gcloud command"
_local_zshrc_ssh_config_needs_cleanup() { _local_zshrc_ssh_config_needs_cleanup() {
[ ! -f ~/.ssh/config ] || grep -iq '^\s\+IdentityFile' ~/.ssh/config [ ! -f ~/.ssh/config ] || grep -iq '^\s\+IdentityFile' ~/.ssh/config
@ -192,6 +194,9 @@ _local_zshrc_clean_up_ssh_config() {
gcloud() { gcloud() {
command gcloud "$@" command gcloud "$@"
if _local_zshrc_ssh_config_needs_cleanup; then
_local_zshrc_clean_up_ssh_config
fi
} }
if has_binary gke-gcloud-auth-plugin; then if has_binary gke-gcloud-auth-plugin; then
@ -199,6 +204,7 @@ if has_binary gke-gcloud-auth-plugin; then
log "Setting USE_GKE_GCLOUD_AUTH_PLUGIN=True to avoid deprecation warning" log "Setting USE_GKE_GCLOUD_AUTH_PLUGIN=True to avoid deprecation warning"
USE_GKE_GCLOUD_AUTH_PLUGIN=True USE_GKE_GCLOUD_AUTH_PLUGIN=True
fi fi
fi
section_end section_end
# symfony cli # symfony cli