Repository: JanDeDobbeleer/oh-my-posh
Pull request #729 (2021-05-21 06:33:49)

powershell
- fix: add round style to schema
- fix(pwsh): get filesystem path for configs

### Prerequisites

- [x] I have read and understand the `CONTRIBUTING` guide
- [x] The commit message follows the [conventional commits][cc] guidelines
- [x] Tests for the changes have been added (for bug fixes / features)
- [x] Docs have been added / updated (for bug fixes / features)

### Description

[Description of the change]

### Tips

If you're not comfortable working with git, we're working a [guide][docs] to help you out.
Oh my Posh advises [GitKraken][kraken] as your preferred cross platfrom git GUI powertool.

[cc]: https://www.conventionalcommits.org/en/v1.0.0/#summary
[docs]: https://ohmyposh.dev/docs/contributing_git
[kraken]: https://www.gitkraken.com/invite/nQmDPR9D



Patch:
diff --git a/docs/docs/segment-az.md b/docs/docs/segment-az.mdx
similarity index 63%
rename from docs/docs/segment-az.md
rename to docs/docs/segment-az.mdx
index ee84d34b..58cbd7d1 100644
--- a/docs/docs/segment-az.md
+++ b/docs/docs/segment-az.mdx
@@ -8,6 +8,11 @@ sidebar_label: Azure
 
 Display the currently active Azure subscription information.
 
+:::info
+PowerShell offers support for the `Az.Accounts` module, but it is disabled by default.
+To enable this, set `$env:AZ_ENABLED = $true` in your `$PROFILE`.
+:::
+
 ## Sample Configuration
 
 ```json
@@ -28,6 +33,7 @@ Display the currently active Azure subscription information.
 
 ## Properties
 
-- info_separator: `string` - text/icon to put in between the subscription name and ID - defaults to ` | `
-- display_id: `boolean` - display the subscription ID or not - defaults to `false`
+- display_account: `boolean` - display the subscription account name or not - defaults to `false`
 - display_name: `boolean` - display the subscription name or not - defaults to `true`
+- display_id: `boolean` - display the subscription ID or not - defaults to `false`
+- info_separator: `string` - text/icon to put in between the values - defaults to ` | `
diff --git a/docs/docs/segment-git.md b/docs/docs/segment-git.mdx
similarity index 95%
rename from docs/docs/segment-git.md
rename to docs/docs/segment-git.mdx
index 95748988..35df16c4 100644
--- a/docs/docs/segment-git.md
+++ b/docs/docs/segment-git.mdx
@@ -14,6 +14,11 @@ Local changes can also shown by default using the following syntax for both the
 - `-` deleted
 - `?` untracked
 
+:::info
+PowerShell offers support for the `posh-git` module for autocompletion, but it is disabled by default.
+To enable this, set `$env:POSH_GIT_ENABLED = $true` in your `$PROFILE`.
+:::
+
 ## Sample Configuration
 
 ```json
diff --git a/docs/docs/segment-posh-git.mdx b/docs/docs/segment-posh-git.mdx
index c17ba8d3..a7f581b5 100644
--- a/docs/docs/segment-posh-git.mdx
+++ b/docs/docs/segment-posh-git.mdx
@@ -10,6 +10,7 @@ Display the [posh-git][posh-git] prompt.
 
 :::info
 This segment only works within Powershell and requires the posh-git module to be installed and imported.
+To enable the `posh-git` module, set `$env:POSH_GIT_ENABLED = $true` in your `$PROFILE`.
 :::
 
 ## Sample Configuration
diff --git a/packages/powershell/oh-my-posh/oh-my-posh.psm1 b/packages/powershell/oh-my-posh/oh-my-posh.psm1
index 7b24340f..3f4fb997 100644
--- a/packages/powershell/oh-my-posh/oh-my-posh.psm1
+++ b/packages/powershell/oh-my-posh/oh-my-posh.psm1
@@ -51,10 +51,11 @@ function Set-PoshPrompt {
 
     $config = ""
     if (Test-Path "$PSScriptRoot/themes/$Theme.omp.json") {
-        $config = "$PSScriptRoot/themes/$Theme.omp.json"
+        $path = "$PSScriptRoot/themes/$Theme.omp.json"
+        $config = (Resolve-Path -Path $path).ProviderPath
     }
     elseif (Test-Path $Theme) {
-        $config = (Resolve-Path -Path $Theme).Path
+        $config = (Resolve-Path -Path $Theme).ProviderPath
     }
     else {
         $config = "$PSScriptRoot/themes/jandedobbeleer.omp.json"
diff --git a/src/.golangci.yml b/src/.golangci.yml
index f048ae37..7e1b234f 100644
--- a/src/.golangci.yml
+++ b/src/.golangci.yml
@@ -15,7 +15,7 @@ linters:
     - gocyclo
     - gofmt
     - goimports
-    - golint
+    - revive
     - goprintffuncname
     - gosimple
     - govet
diff --git a/src/ansi.go b/src/ansi.go
index 992b0960..0b2c295b 100644
--- a/src/ansi.go
+++ b/src/ansi.go
@@ -6,7 +6,7 @@ import (
 )
 
 const (
-	ANSIRegex = "[\u001B\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"
+	ansiRegex = "[\u001B\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"
 )
 
 type ansiUtils struct {
@@ -105,14 +105,14 @@ func (a *ansiUtils) lenWithoutANSI(text string) int {
 	// replace hyperlinks
 	matches := findAllNamedRegexMatch(`(?P<STR>\x1b]8;;file:\/\/(.+)\x1b\\(?P<URL>.+)\x1b]8;;\x1b\\)`, text)
 	for _, match := range matches {
-		text = strings.ReplaceAll(text, match[STR], match[URL])
+		text = strings.ReplaceAll(text, match[str], match[url])
 	}
 	// replace console title
 	matches = findAllNamedRegexMatch(`(?P<STR>\x1b\]0;(.+)\007)`, text)
 	for _, match := range matches {
-		text = strings.ReplaceAll(text, match[STR], "")
+		text = strings.ReplaceAll(text, match[str], "")
 	}
-	stripped := replaceAllString(ANSIRegex, text, "")
+	stripped := replaceAllString(ansiRegex, text, "")
 	stripped = strings.ReplaceAll(stripped, a.escapeLeft, "")
 	stripped = strings.ReplaceAll(stripped, a.escapeRight, "")
 	runeText := []rune(stripped)
diff --git a/src/ansi_color.go b/src/ansi_color.go
index f2468a96..7570fc06 100644
--- a/src/ansi_color.go
+++ b/src/ansi_color.go
@@ -10,7 +10,7 @@ import (
 
 var (
 	// Map for color names and their respective foreground [0] or background [1] color codes
-	colorMap map[string][2]string = map[string][2]string{
+	colorMap = map[string][2]string{
 		"black":        {"30", "40"},
 		"red":          {"31", "41"},
 		"green":        {"32", "42"},
diff --git a/src/environment_windows_win32.go b/src/environment_windows_win32.go
index f42a8477..3da60886 100644
--- a/src/environment_windows_win32.go
+++ b/src/environment_windows_win32.go
@@ -150,7 +150,7 @@ func GetWindowTitle(pid int, windowTitleRegex string) (syscall.Handle, string) {
 
 	// callback fro EnumWindows
 	cb := syscall.NewCallback(func(h syscall.Handle, p uintptr) uintptr {
-		var prcsID int = 0
+		var prcsID int
 		// get pid
 		_, _, _ = procGetWindowThreadProcessID.Call(uintptr(h), uintptr(unsafe.Pointer(&prcsID)))
 		// check if pid matches spotify pid
diff --git a/src/image.go b/src/image.go
index 19a688a8..7d26a5e4 100644
--- a/src/image.go
+++ b/src/image.go
@@ -41,10 +41,11 @@ const (
 	green  = "#71BD47"
 
 	// known ansi sequences
-	FG                  = "FG"
-	BG                  = "BG"
-	STR                 = "STR"
-	URL                 = "URL"
+
+	fg                  = "FG"
+	bg                  = "BG"
+	str                 = "STR"
+	url                 = "URL"
 	invertedColor       = "inverted"
 	invertedColorSingle = "invertedsingle"
 	fullColor           = "full"
@@ -355,24 +356,24 @@ func (ir *ImageRenderer) shouldPrint() bool {
 		if len(match) == 0 {
 			continue
 		}
-		ir.ansiString = strings.TrimPrefix(ir.ansiString, match[STR])
+		ir.ansiString = strings.TrimPrefix(ir.ansiString, match[str])
 		switch sequence {
 		case invertedColor:
 			ir.foregroundColor = ir.defaultBackgroundColor
-			ir.backgroundColor = NewRGBColor(match[BG])
+			ir.backgroundColor = NewRGBColor(match[bg])
 			return false
 		case invertedColorSingle:
 			ir.foregroundColor = ir.defaultBackgroundColor
-			color, _ := strconv.Atoi(match[BG])
+			color, _ := strconv.Atoi(match[bg])
 			color += 10
 			ir.setBase16Color(fmt.Sprint(color))
 			return false
 		case fullColor:
-			ir.foregroundColor = NewRGBColor(match[FG])
-			ir.backgroundColor = NewRGBColor(match[BG])
+			ir.foregroundColor = NewRGBColor(match[fg])
+			ir.backgroundColor = NewRGBColor(match[bg])
 			return false
 		case foreground:
-			ir.foregroundColor = NewRGBColor(match[FG])
+			ir.foregroundColor = NewRGBColor(match[fg])
 			return false
 		case reset:
 			ir.foregroundColor = ir.defaultForegroundColor
@@ -387,10 +388,10 @@ func (ir *ImageRenderer) shouldPrint() bool {
 		case strikethrough, strikethroughReset, left, osc99, lineChange, title:
 			return false
 		case color16:
-			ir.setBase16Color(match[FG])
+			ir.setBase16Color(match[fg])
 			return false
 		case link:
-			ir.ansiString = match[URL] + ir.ansiString
+			ir.ansiString = match[url] + ir.ansiString
 		}
 	}
 	return true
diff --git a/src/init/omp.ps1 b/src/init/omp.ps1
index 9a54d5de..5592ce5b 100644
--- a/src/init/omp.ps1
+++ b/src/init/omp.ps1
@@ -4,6 +4,23 @@
 $env:POWERLINE_COMMAND = "oh-my-posh"
 $env:CONDA_PROMPT_MODIFIER = $false
 
+# specific module support (disabled by default)
+function Set-DefaultEnvValue {
+    [CmdletBinding()]
+    param (
+        [Parameter(Mandatory = $true)]
+        [string]
+        $Name
+    )
+
+    $value = [System.Environment]::GetEnvironmentVariable($Name)
+    if ($value -eq $null) {
+        [System.Environment]::SetEnvironmentVariable($Name, $false)
+    }
+}
+Set-DefaultEnvValue("AZ_ENABLED")
+Set-DefaultEnvValue("POSH_GIT_ENABLED")
+
 $global:PoshSettings = New-Object -TypeName PSObject -Property @{
     Theme = "";
 }
@@ -13,37 +30,28 @@ $global:omp_lastHistoryId = -1
 
 $config = "::CONFIG::"
 if (Test-Path $config) {
-    $global:PoshSettings.Theme = (Resolve-Path -Path $config).Path
+    $global:PoshSettings.Theme = (Resolve-Path -Path $config).ProviderPath
 }
 
 function global:Set-PoshContext {}
 
 function global:Initialize-ModuleSupport {
-    if (Get-Module -Name "posh-git") {
+    if ($env:POSH_GIT_ENABLED -eq $true -and (Get-Module -Name "posh-git")) {
         [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSProvideCommentHelp', '', Justification = 'Variable used later(not in this scope)')]
         $global:GitStatus = Get-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_ID = $null
 
     if ($env:AZ_ENABLED -eq $true) {
         try {
-            $subscription = Get-AzContext | Select-Object -ExpandProperty "Subscription" | Select-Object "Name", "Id"
+            $subscription = Get-AzContext | Select-Object -ExpandProperty "Subscription" | Select-Object "Name", "Id", "Account"
             if ($null -ne $subscription) {
                 $env:AZ_SUBSCRIPTION_NAME = $subscription.Name
                 $env:AZ_SUBSCRIPTION_ID = $subscription.Id
+                $env:AZ_SUBSCRIPTION_ACCOUNT = $subscription.Account
             }
         }
         catch {}
diff --git a/src/main.go b/src/main.go
index 3e7ba17c..da8a7c43 100644
--- a/src/main.go
+++ b/src/main.go
@@ -210,7 +210,7 @@ func main() {
 	}
 	imageCreator.init()
 	match := findNamedRegexMatch(`.*(\/|\\)(?P<STR>.+).omp.(json|yaml|toml)`, *args.Config)
-	err := imageCreator.SavePNG(fmt.Sprintf("%s.png", match[STR]))
+	err := imageCreator.SavePNG(fmt.Sprintf("%s.png", match[str]))
 	if err != nil {
 		fmt.Print(err.Error())
 	}
diff --git a/src/regex.go b/src/regex.go
index 8cd9f57b..b151d4d4 100644
--- a/src/regex.go
+++ b/src/regex.go
@@ -6,8 +6,8 @@ import (
 )
 
 var (
-	regexCache     map[string]*regexp.Regexp = make(map[string]*regexp.Regexp)
-	regexCacheLock                           = sync.RWMutex{}
+	regexCache     = make(map[string]*regexp.Regexp)
+	regexCacheLock = sync.RWMutex{}
 )
 
 func getCompiledRegex(pattern string) *regexp.Regexp {
diff --git a/src/segment_az.go b/src/segment_az.go
index 4b2afb5e..088f18a0 100644
--- a/src/segment_az.go
+++ b/src/segment_az.go
@@ -1,15 +1,17 @@
 package main
 
 import (
-	"fmt"
 	"strings"
 )
 
 type az struct {
-	props *properties
-	env   environmentInfo
-	name  string
-	id    string
+	props     *properties
+	env       environmentInfo
+	name      string
+	id        string
+	account   string
+	builder   strings.Builder
+	separator string
 }
 
 const (
@@ -19,6 +21,8 @@ const (
 	DisplaySubscriptionID Property = "display_id"
 	// DisplaySubscriptionName hides or shows the subscription display name
 	DisplaySubscriptionName Property = "display_name"
+	// DisplaySubscriptionAccount hides or shows the subscription account name
+	DisplaySubscriptionAccount Property = "display_account"
 
 	updateConsentNeeded = "Do you want to continue?"
 	updateMessage       = "AZ CLI: Update needed!"
@@ -27,12 +31,27 @@ const (
 )
 
 func (a *az) string() string {
-	separator := ""
-	if a.idEnabled() && a.nameEnabled() {
-		separator = a.props.getString(SubscriptionInfoSeparator, " | ")
+	a.separator = a.props.getString(SubscriptionInfoSeparator, " | ")
+	writeValue := func(value string) {
+		if len(value) == 0 {
+			return
+		}
+		if a.builder.Len() > 0 {
+			a.builder.WriteString(a.separator)
+		}
+		a.builder.WriteString(value)
+	}
+	if a.props.getBool(DisplaySubscriptionAccount, false) {
+		writeValue(a.account)
+	}
+	if a.props.getBool(DisplaySubscriptionName, true) {
+		writeValue(a.name)
+	}
+	if a.props.getBool(DisplaySubscriptionID, false) {
+		writeValue(a.id)
 	}
 
-	return fmt.Sprintf("%s%s%s", a.getName(), separator, a.getID())
+	return a.builder.String()
 }
 
 func (a *az) init(props *properties, env environmentInfo) {
@@ -41,75 +60,50 @@ func (a *az) init(props *properties, env environmentInfo) {
 }
 
 func (a *az) enabled() bool {
-	var enabled bool
-	a.name, a.id, enabled = a.getFromEnvVars()
-	if enabled {
-		return enabled
+	if a.getFromEnvVars() {
+		return true
 	}
 
-	a.name, a.id, enabled = a.getFromAzCli()
-	return enabled
+	return a.getFromAzCli()
 }
 
-func (a *az) getFromEnvVars() (string, string, bool) {
-	name := a.env.getenv("AZ_SUBSCRIPTION_NAME")
-	id := a.env.getenv("AZ_SUBSCRIPTION_ID")
+func (a *az) getFromEnvVars() bool {
+	a.name = a.env.getenv("AZ_SUBSCRIPTION_NAME")
+	a.id = a.env.getenv("AZ_SUBSCRIPTION_ID")
+	a.account = a.env.getenv("AZ_SUBSCRIPTION_ID")
 
-	if name == "" && id == "" {
-		return "", "", false
+	if a.name == "" && a.id == "" {
+		return false
 	}
 
-	return name, id, true
+	return true
 }
 
-func (a *az) getFromAzCli() (string, string, bool) {
+func (a *az) getFromAzCli() bool {
 	cmd := "az"
-	if (!a.idEnabled() && !a.nameEnabled()) || !a.env.hasCommand(cmd) {
-		return "", "", false
+	if !a.env.hasCommand(cmd) {
+		return false
 	}
 
-	output, _ := a.env.runCommand(cmd, "account", "show", "--query=[name,id]", "-o=tsv")
-	if output == "" {
-		return "", "", false
+	output, _ := a.env.runCommand(cmd, "account", "show", "--query=[name,id,user.name]", "-o=tsv")
+	if len(output) == 0 {
+		return false
 	}
 
 	if strings.Contains(output, updateConsentNeeded) {
 		a.props.foreground = updateForeground
 		a.props.background = updateBackground
-		return updateMessage, "", true
+		a.name = updateMessage
+		return true
 	}
 
 	splittedOutput := strings.Split(output, "\n")
-	if len(splittedOutput) < 2 {
-		return "", "", false
-	}
-
-	name := strings.TrimSpace(splittedOutput[0])
-	id := strings.TrimSpace(splittedOutput[1])
-
-	return name, id, true
-}
-
-func (a *az) getID() string {
-	if !a.idEnabled() {
-		return ""
+	if len(splittedOutput) < 3 {
+		return false
 	}
 
-	return a.id
-}
-
-func (a *az) getName() string {
-	if !a.nameEnabled() {
-		return ""
-	}
-
-	return a.name
-}
-
-func (a *az) idEnabled() bool {
-	return a.props.getBool(DisplaySubscriptionID, false)
-}
-
-func (a *az) nameEnabled() bool {
-	return a.props.getBool(DisplaySubscriptionName, true)
+	a.name = strings.TrimSpace(splittedOutput[0])
+	a.id = strings.TrimSpace(splittedOutput[1])
+	a.account = strings.TrimSpace(splittedOutput[2])
+	return true
 }
diff --git a/themes/schema.json b/themes/schema.json
index 66c3888a..c2b9c41d 100644
--- a/themes/schema.json
+++ b/themes/schema.json
@@ -1521,7 +1521,8 @@
                       "dallas",
                       "galveston",
                       "houston",
-                      "amarillo"
+                      "amarillo",
+                      "round"
                     ],
                     "default": "austin"
                   }


Test patch:
diff --git a/src/segment_az_test.go b/src/segment_az_test.go
index c9656744..6f6087e5 100644
--- a/src/segment_az_test.go
+++ b/src/segment_az_test.go
@@ -14,13 +14,29 @@ func TestAzSegment(t *testing.T) {
 		ExpectedString  string
 		EnvSubName      string
 		EnvSubID        string
+		EnvSubAccount   string
 		CliExists       bool
 		CliSubName      string
 		CliSubID        string
+		CliSubAccount   string
 		InfoSeparator   string
 		DisplayID       bool
 		DisplayName     bool
+		DisplayAccount  bool
 	}{
+		{
+			Case:            "print only account",
+			ExpectedEnabled: true,
+			ExpectedString:  "foobar",
+			CliExists:       true,
+			CliSubName:      "foo",
+			CliSubID:        "bar",
+			CliSubAccount:   "foobar",
+			InfoSeparator:   "$",
+			DisplayID:       false,
+			DisplayName:     false,
+			DisplayAccount:  true,
+		},
 		{
 			Case:            "envvars present",
 			ExpectedEnabled: true,
@@ -35,7 +51,7 @@ func TestAzSegment(t *testing.T) {
 		{
 			Case:            "envvar name present",
 			ExpectedEnabled: true,
-			ExpectedString:  "foo$",
+			ExpectedString:  "foo",
 			EnvSubName:      "foo",
 			CliExists:       false,
 			InfoSeparator:   "$",
@@ -45,7 +61,7 @@ func TestAzSegment(t *testing.T) {
 		{
 			Case:            "envvar id present",
 			ExpectedEnabled: true,
-			ExpectedString:  "$bar",
+			ExpectedString:  "bar",
 			EnvSubID:        "bar",
 			CliExists:       false,
 			InfoSeparator:   "$",
@@ -55,7 +71,7 @@ func TestAzSegment(t *testing.T) {
 		{
 			Case:            "cli not found",
 			ExpectedEnabled: false,
-			ExpectedString:  "$",
+			ExpectedString:  "",
 			CliExists:       false,
 			InfoSeparator:   "$",
 			DisplayID:       true,
@@ -96,13 +112,11 @@ func TestAzSegment(t *testing.T) {
 		},
 		{
 			Case:            "print none",
-			ExpectedEnabled: false,
+			ExpectedEnabled: true,
 			CliExists:       true,
 			CliSubName:      "foo",
 			CliSubID:        "bar",
 			InfoSeparator:   "$",
-			DisplayID:       false,
-			DisplayName:     false,
 		},
 		{
 			Case:            "update needed",
@@ -113,6 +127,16 @@ func TestAzSegment(t *testing.T) {
 			DisplayID:       false,
 			DisplayName:     true,
 		},
+		{
+			Case:            "account info",
+			ExpectedEnabled: true,
+			ExpectedString:  updateMessage,
+			CliExists:       true,
+			CliSubName:      "Do you want to continue? (Y/n): Visual Studio Enterprise",
+			DisplayID:       false,
+			DisplayName:     true,
+			DisplayAccount:  true,
+		},
 	}
 
 	for _, tc := range cases {
@@ -120,12 +144,16 @@ func TestAzSegment(t *testing.T) {
 		env.On("getenv", "AZ_SUBSCRIPTION_NAME").Return(tc.EnvSubName)
 		env.On("getenv", "AZ_SUBSCRIPTION_ID").Return(tc.EnvSubID)
 		env.On("hasCommand", "az").Return(tc.CliExists)
-		env.On("runCommand", "az", []string{"account", "show", "--query=[name,id]", "-o=tsv"}).Return(fmt.Sprintf("%s\n%s\n", tc.CliSubName, tc.CliSubID), nil)
+		env.On("runCommand", "az", []string{"account", "show", "--query=[name,id,user.name]", "-o=tsv"}).Return(
+			fmt.Sprintf("%s\n%s\n%s\n", tc.CliSubName, tc.CliSubID, tc.CliSubAccount),
+			nil,
+		)
 		props := &properties{
 			values: map[Property]interface{}{
-				SubscriptionInfoSeparator: tc.InfoSeparator,
-				DisplaySubscriptionID:     tc.DisplayID,
-				DisplaySubscriptionName:   tc.DisplayName,
+				SubscriptionInfoSeparator:  tc.InfoSeparator,
+				DisplaySubscriptionID:      tc.DisplayID,
+				DisplaySubscriptionName:    tc.DisplayName,
+				DisplaySubscriptionAccount: tc.DisplayAccount,
 			},
 		}
 
diff --git a/src/segment_kubectl_test.go b/src/segment_kubectl_test.go
index 40b40971..5b5d5f00 100644
--- a/src/segment_kubectl_test.go
+++ b/src/segment_kubectl_test.go
@@ -19,7 +19,7 @@ func bootStrapKubectlTest(args *kubectlArgs) *kubectl {
 	env := new(MockedEnvironment)
 	env.On("hasCommand", "kubectl").Return(args.kubectlExists)
 	kubectlOut := args.context + "," + args.namespace
-	var kubectlErr error = nil
+	var kubectlErr error
 	if args.kubectlErr {
 		kubectlErr = &commandError{
 			err:      "oops",