Repository: JanDeDobbeleer/oh-my-posh
Pull request #1569 (2022-01-13 19:15:59)

chore(deps): bump follow-redirects from 1.14.6 to 1.14.7 in /docs/api
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.6 to 1.14.7.
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/follow-redirects/follow-redirects/commit/2ede36d7c60d3acdcd324dcd99a9dbd52e4fb3a6"><code>2ede36d</code></a> Release version 1.14.7 of the npm package.</li>
<li><a href="https://github.com/follow-redirects/follow-redirects/commit/8b347cbcef7c7b72a6e9be20f5710c17d6163c22"><code>8b347cb</code></a> Drop Cookie header across domains.</li>
<li>See full diff in <a href="https://github.com/follow-redirects/follow-redirects/compare/v1.14.6...v1.14.7">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=follow-redirects&package-manager=npm_and_yarn&previous-version=1.14.6&new-version=1.14.7)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language

You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/JanDeDobbeleer/oh-my-posh/network/alerts).

</details>


Patch:
diff --git a/docs/api/package-lock.json b/docs/api/package-lock.json
index 11975727..0465de50 100644
--- a/docs/api/package-lock.json
+++ b/docs/api/package-lock.json
@@ -13,9 +13,9 @@
       }
     },
     "follow-redirects": {
-      "version": "1.14.6",
-      "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.6.tgz",
-      "integrity": "sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A=="
+      "version": "1.14.7",
+      "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz",
+      "integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ=="
     }
   }
 }
diff --git a/src/segment_az.go b/src/segment_az.go
index e322d599..33835f8e 100644
--- a/src/segment_az.go
+++ b/src/segment_az.go
@@ -11,6 +11,7 @@ type az struct {
 	env   Environment
 
 	AzureSubscription
+	Origin string
 }
 
 type AzureConfig struct {
@@ -96,20 +97,24 @@ func (a *az) init(props Properties, env Environment) {
 	a.env = env
 }
 
+func (a *az) enabled() bool {
+	return a.getAzureProfile() || a.getAzureRmContext()
+}
+
 func (a *az) getFileContentWithoutBom(file string) string {
-	const ByteOrderMark = "\ufeff"
-	file = filepath.Join(a.env.homeDir(), file)
+	azFolder := ".azure"
+	if a.env.getRuntimeGOOS() == linuxPlatform {
+		azFolder = ".Azure"
+	}
+	file = filepath.Join(a.env.homeDir(), azFolder, file)
 	config := a.env.getFileContent(file)
+	const ByteOrderMark = "\ufeff"
 	return strings.TrimLeft(config, ByteOrderMark)
 }
 
-func (a *az) enabled() bool {
-	return a.getAzureProfile() || a.getAzureRmContext()
-}
-
 func (a *az) getAzureProfile() bool {
 	var content string
-	if content = a.getFileContentWithoutBom(".azure/azureProfile.json"); len(content) == 0 {
+	if content = a.getFileContentWithoutBom("azureProfile.json"); len(content) == 0 {
 		return false
 	}
 	var config AzureConfig
@@ -119,6 +124,7 @@ func (a *az) getAzureProfile() bool {
 	for _, subscription := range config.Subscriptions {
 		if subscription.IsDefault {
 			a.AzureSubscription = *subscription
+			a.Origin = "CLI"
 			return true
 		}
 	}
@@ -127,7 +133,7 @@ func (a *az) getAzureProfile() bool {
 
 func (a *az) getAzureRmContext() bool {
 	var content string
-	if content = a.getFileContentWithoutBom(".azure/AzureRmContext.json"); len(content) == 0 {
+	if content = a.getFileContentWithoutBom("AzureRmContext.json"); len(content) == 0 {
 		return false
 	}
 	var config AzurePowerShellConfig
@@ -147,5 +153,6 @@ func (a *az) getAzureRmContext() bool {
 	a.User = &AzureUser{
 		Name: defaultContext.Subscription.ExtendedProperties.Account,
 	}
+	a.Origin = "PWSH"
 	return true
 }


Test patch:
diff --git a/src/segment_az_test.go b/src/segment_az_test.go
index bf0fed44..ffb676f0 100644
--- a/src/segment_az_test.go
+++ b/src/segment_az_test.go
@@ -42,6 +42,20 @@ func TestAzSegment(t *testing.T) {
 			Template:        "{{ .Burp }}",
 			HasPowerShell:   true,
 		},
+		{
+			Case:            "PWSH",
+			ExpectedEnabled: true,
+			ExpectedString:  "PWSH",
+			Template:        "{{ .Origin }}",
+			HasPowerShell:   true,
+		},
+		{
+			Case:            "CLI",
+			ExpectedEnabled: true,
+			ExpectedString:  "CLI",
+			Template:        "{{ .Origin }}",
+			HasCLI:          true,
+		},
 	}
 
 	for _, tc := range cases {
@@ -57,8 +71,9 @@ func TestAzSegment(t *testing.T) {
 			content, _ := ioutil.ReadFile("./test/AzureRmContext.json")
 			azureRmContext = string(content)
 		}
-		env.On("getFileContent", filepath.Join(home, ".azure/azureProfile.json")).Return(azureProfile)
-		env.On("getFileContent", filepath.Join(home, ".azure/AzureRmContext.json")).Return(azureRmContext)
+		env.On("getRuntimeGOOS", nil).Return(linuxPlatform)
+		env.On("getFileContent", filepath.Join(home, ".Azure", "azureProfile.json")).Return(azureProfile)
+		env.On("getFileContent", filepath.Join(home, ".Azure", "AzureRmContext.json")).Return(azureRmContext)
 		env.onTemplate()
 		props := properties{
 			SegmentTemplate: tc.Template,