Remove flag_windows and use runtime
This commit is contained in:
parent
374bbfb3da
commit
96bff3c5e1
10
flag.go
10
flag.go
@ -5,7 +5,9 @@ import (
|
|||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
@ -279,7 +281,13 @@ func defaultEnvFormat(envVars []string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func withEnvHint(envVars []string, str 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 {
|
func FlagNames(name string, aliases []string) []string {
|
||||||
|
@ -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
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user