mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-28 20:39:40 -08:00
parent
744764a05e
commit
f4fa7a4166
|
@ -42,14 +42,15 @@ Display the currently active Azure subscription information.
|
||||||
|
|
||||||
### Properties
|
### Properties
|
||||||
|
|
||||||
- `.EnvironmentName`: `string` - the account environment name
|
- `.EnvironmentName`: `string` - account environment name
|
||||||
- `.HomeTenantID`: `string` - the home tenant id
|
- `.HomeTenantID`: `string` - home tenant id
|
||||||
- `.ID`: `string` - the account/subscription id
|
- `.ID`: `string` - account/subscription id
|
||||||
- `.IsDefault`: `boolean` - is the default account or not
|
- `.IsDefault`: `boolean` - is the default account or not
|
||||||
- `.Name`: `string` - the account name
|
- `.Name`: `string` - account name
|
||||||
- `.State`: `string` - the account state
|
- `.State`: `string` - account state
|
||||||
- `.TenantID`: `string` - the tenant id
|
- `.TenantID`: `string` - tenant id
|
||||||
- `.User.Name`: `string` - the user name
|
- `.User.Name`: `string` - user name
|
||||||
|
- `.User.Type`: `string` - user type
|
||||||
- `.Origin`: `string` - where we received the information from, can be `CLI` or `PWSH`
|
- `.Origin`: `string` - where we received the information from, can be `CLI` or `PWSH`
|
||||||
|
|
||||||
[templates]: /docs/config-templates
|
[templates]: /docs/config-templates
|
||||||
|
|
|
@ -43,6 +43,7 @@ type AzureSubscription struct {
|
||||||
|
|
||||||
type AzureUser struct {
|
type AzureUser struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
Type string `json:"type"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AzurePowerShellConfig struct {
|
type AzurePowerShellConfig struct {
|
||||||
|
@ -166,6 +167,7 @@ func (a *Az) getModuleSubscription() bool {
|
||||||
a.State = defaultContext.Subscription.State
|
a.State = defaultContext.Subscription.State
|
||||||
a.User = &AzureUser{
|
a.User = &AzureUser{
|
||||||
Name: defaultContext.Subscription.ExtendedProperties.Account,
|
Name: defaultContext.Subscription.ExtendedProperties.Account,
|
||||||
|
Type: defaultContext.Account.Type,
|
||||||
}
|
}
|
||||||
a.Origin = "PWSH"
|
a.Origin = "PWSH"
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -97,6 +97,14 @@ func TestAzSegment(t *testing.T) {
|
||||||
Template: "{{ .EnvironmentName }}",
|
Template: "{{ .EnvironmentName }}",
|
||||||
Source: pwsh,
|
Source: pwsh,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Case: "Az CLI account type",
|
||||||
|
ExpectedEnabled: true,
|
||||||
|
ExpectedString: "user",
|
||||||
|
Template: "{{ .User.Type }}",
|
||||||
|
HasCLI: true,
|
||||||
|
Source: cli,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"My Azure Subscription (subscription_id) - tenant_id - user_name": {
|
"My Azure Subscription (subscription_id) - tenant_id - user_name": {
|
||||||
"Account": {
|
"Account": {
|
||||||
"Id": "232-232-232-232",
|
"Id": "232-232-232-232",
|
||||||
"Type": "User",
|
"Type": "user",
|
||||||
"TenantMap": {},
|
"TenantMap": {},
|
||||||
"ExtendedProperties": {
|
"ExtendedProperties": {
|
||||||
"Subscriptions": "subscription_ids",
|
"Subscriptions": "subscription_ids",
|
||||||
|
|
Loading…
Reference in a new issue