mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-28 20:39:40 -08:00
perf(az): improve performance for az powershell
This commit is contained in:
parent
bb6a90a867
commit
4597f158c4
|
@ -23,10 +23,20 @@ function global:Initialize-ModuleSupport {
|
||||||
$env:POSH_GIT_STATUS = Write-GitStatus -Status $global:GitStatus
|
$env:POSH_GIT_STATUS = Write-GitStatus -Status $global:GitStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($null -eq $env:AZ_ENABLED) {
|
||||||
|
if (Get-Module -ListAvailable -Name "Az.Accounts") {
|
||||||
|
$env:AZ_ENABLED = $true
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$env:AZ_ENABLED = $false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$env:AZ_SUBSCRIPTION_NAME = $null
|
$env:AZ_SUBSCRIPTION_NAME = $null
|
||||||
$env:AZ_SUBSCRIPTION_ID = $null
|
$env:AZ_SUBSCRIPTION_ID = $null
|
||||||
|
|
||||||
if (Get-Module -ListAvailable -Name "Az.Accounts") {
|
if ($env:AZ_ENABLED -eq $true) {
|
||||||
try {
|
try {
|
||||||
$subscription = Get-AzContext | Select-Object -ExpandProperty "Subscription" | Select-Object "Name", "Id"
|
$subscription = Get-AzContext | Select-Object -ExpandProperty "Subscription" | Select-Object "Name", "Id"
|
||||||
if ($null -ne $subscription) {
|
if ($null -ne $subscription) {
|
||||||
|
|
Loading…
Reference in a new issue