Remove flag_windows and use runtime

This commit is contained in:
Naveen Gogineni 2022-10-19 09:44:21 -04:00
parent 374bbfb3da
commit 96bff3c5e1
2 changed files with 9 additions and 15 deletions

10
flag.go
View File

@ -5,7 +5,9 @@ import (
"flag"
"fmt"
"io/ioutil"
"os"
"regexp"
"runtime"
"strings"
"syscall"
"time"
@ -279,7 +281,13 @@ func defaultEnvFormat(envVars []string) string {
}
func withEnvHint(envVars []string, str string) string {
return str + defaultEnvFormat(envVars)
envText := ""
if runtime.GOOS != "windows" || os.Getenv("PSHOME") != "" {
envText = defaultEnvFormat(envVars)
} else {
envText = envFormat(envVars, "%", "%, %", "%")
}
return str + envText
}
func FlagNames(name string, aliases []string) []string {

View File

@ -1,14 +0,0 @@
package cli
import "os"
func withEnvHint(envVars []string, str string) string {
// if we are running is powershell this env var is set
// and so we should use the default env format
if os.Getenv("PSHOME") != "" {
envText = defaultEnvFormat(envVars)
} else {
envText = envFormat(envVars, "%", "%, %", "%")
}
return str + envText
}