summaryrefslogtreecommitdiff
path: root/plugins/azure/azure.plugin.zsh
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2023-11-04 18:38:46 -0700
committerTuowen Zhao <ztuowen@gmail.com>2023-11-04 18:38:46 -0700
commit4d908094fdc2a0c0e9a0a072eba213fab7adef43 (patch)
tree7c17e70bcdeebbe96c84d849bdf17882007480d8 /plugins/azure/azure.plugin.zsh
parent4b0bbc0b263a150eb9a9b59f196914629be06a9b (diff)
parent632ed413a9ce62747ded83d7736491b081be4b49 (diff)
downloadzsh-master.tar.gz
zsh-master.tar.bz2
zsh-master.zip
Merge remote-tracking branch 'github/master'HEADmaster
Diffstat (limited to 'plugins/azure/azure.plugin.zsh')
-rw-r--r--plugins/azure/azure.plugin.zsh14
1 files changed, 6 insertions, 8 deletions
diff --git a/plugins/azure/azure.plugin.zsh b/plugins/azure/azure.plugin.zsh
index 51b54dbc1..b33b0f805 100644
--- a/plugins/azure/azure.plugin.zsh
+++ b/plugins/azure/azure.plugin.zsh
@@ -1,4 +1,4 @@
-# AZ Get Subscritions
+# AZ Get Subscriptions
function azgs() {
az account show --output tsv --query 'name' 2>/dev/null
}
@@ -18,10 +18,10 @@ compctl -K _az_subscriptions azss
# Azure prompt
function azure_prompt_info() {
- [[ ! -f "${AZURE_CONFIG_DIR:-$HOME/.azure/azureProfile.json}" ]] && return
+ [[ ! -f "${AZURE_CONFIG_DIR:-$HOME/.azure}/azureProfile.json" ]] && return
# azgs is too expensive, if we have jq, we enable the prompt
(( $+commands[jq] )) || return 1
- azgs=$(jq -r '.subscriptions[] | select(.isDefault==true) .name' ${AZURE_CONFIG_DIR:-$HOME/.azure/azureProfile.json})
+ azgs=$(jq -r '.subscriptions[] | select(.isDefault==true) .name' "${AZURE_CONFIG_DIR:-$HOME/.azure}/azureProfile.json")
echo "${ZSH_THEME_AZURE_PREFIX:=<az:}${azgs}${ZSH_THEME_AZURE_SUFFIX:=>}"
}
@@ -31,11 +31,9 @@ function _az-homebrew-installed() {
# check if Homebrew is installed
(( $+commands[brew] )) || return 1
- # speculatively check default brew prefix
- if [[ -d /usr/local ]]; then
- _brew_prefix=/usr/local
- elif [[ -d /opt/homebrew ]]; then
- _brew_prefix=/opt/homebrew
+ # if so, we assume it's default way to install brew
+ if [[ ${commands[brew]:t2} == bin/brew ]]; then
+ _brew_prefix="${commands[brew]:h:h}" # remove trailing /bin/brew
else
# ok, it is not in the default prefix
# this call to brew is expensive (about 400 ms), so at least let's make it only once