mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-28 12:29:40 -08:00
feat(az): add tenant name
This commit is contained in:
parent
415d310c69
commit
fb9d447c87
|
@ -39,6 +39,7 @@ type AzureSubscription struct {
|
|||
User *AzureUser `json:"user"`
|
||||
IsDefault bool `json:"isDefault"`
|
||||
TenantID string `json:"tenantId"`
|
||||
TenantDisplayName string `json:"tenantDisplayName"`
|
||||
EnvironmentName string `json:"environmentName"`
|
||||
HomeTenantID string `json:"homeTenantId"`
|
||||
ManagedByTenants []any `json:"managedByTenants"`
|
||||
|
@ -67,6 +68,7 @@ type AzurePowerShellSubscription struct {
|
|||
} `json:"Subscription"`
|
||||
Tenant struct {
|
||||
ID string `json:"Id"`
|
||||
Name string `json:"Name"`
|
||||
} `json:"Tenant"`
|
||||
}
|
||||
|
||||
|
@ -126,10 +128,12 @@ func (a *Az) getModuleSubscription() bool {
|
|||
if len(envSubscription) == 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
var config AzurePowerShellSubscription
|
||||
if err := json.Unmarshal([]byte(envSubscription), &config); err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
a.IsDefault = true
|
||||
a.EnvironmentName = config.Environment.Name
|
||||
a.TenantID = config.Tenant.ID
|
||||
|
@ -140,7 +144,10 @@ func (a *Az) getModuleSubscription() bool {
|
|||
Name: config.Subscription.ExtendedProperties.Account,
|
||||
Type: config.Account.Type,
|
||||
}
|
||||
a.TenantDisplayName = config.Tenant.Name
|
||||
|
||||
a.Origin = "PWSH"
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
@ -16,19 +16,21 @@ initializing Oh My Posh.
|
|||
|
||||
## Sample Configuration
|
||||
|
||||
import Config from '@site/src/components/Config.js';
|
||||
import Config from "@site/src/components/Config.js";
|
||||
|
||||
<Config data={{
|
||||
"type": "az",
|
||||
"style": "powerline",
|
||||
"powerline_symbol": "\uE0B0",
|
||||
"foreground": "#000000",
|
||||
"background": "#9ec3f0",
|
||||
"template": " \uebd8 {{ .EnvironmentName }}",
|
||||
"properties": {
|
||||
"source": "pwsh"
|
||||
}
|
||||
}}/>
|
||||
<Config
|
||||
data={{
|
||||
type: "az",
|
||||
style: "powerline",
|
||||
powerline_symbol: "\uE0B0",
|
||||
foreground: "#000000",
|
||||
background: "#9ec3f0",
|
||||
template: " \uebd8 {{ .EnvironmentName }}",
|
||||
properties: {
|
||||
source: "pwsh",
|
||||
},
|
||||
}}
|
||||
/>
|
||||
|
||||
## Properties
|
||||
|
||||
|
@ -49,7 +51,7 @@ import Config from '@site/src/components/Config.js';
|
|||
### Properties
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------------------ | --------- | -------------------------------------------------------------- |
|
||||
| -------------------- | --------- | -------------------------------------------------------------- |
|
||||
| `.EnvironmentName` | `string` | Azure environment name |
|
||||
| `.HomeTenantID` | `string` | home tenant id |
|
||||
| `.ID` | `string` | subscription id |
|
||||
|
@ -57,6 +59,7 @@ import Config from '@site/src/components/Config.js';
|
|||
| `.Name` | `string` | subscription name |
|
||||
| `.State` | `string` | subscription state |
|
||||
| `.TenantID` | `string` | tenant id |
|
||||
| `.TenantDisplayName` | `string` | tenant name |
|
||||
| `.User.Name` | `string` | user name |
|
||||
| `.User.Type` | `string` | user type |
|
||||
| `.Origin` | `string` | where we received the information from, can be `CLI` or `PWSH` |
|
||||
|
|
Loading…
Reference in a new issue