Get commandline from ENV

This commit is contained in:
LTP414 2025-02-09 00:15:41 +08:00 committed by GitHub
parent 46e0472ec1
commit 8e59c8f09c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,10 +1,12 @@
package Common
import (
"os"
"flag"
"fmt"
"github.com/fatih/color"
"strings"
"runtime"
)
func Banner() {
@ -132,7 +134,14 @@ func Flag(Info *HostInfo) {
flag.StringVar(&Language, "lang", "zh", GetText("flag_language"))
flag.Parse()
envArgsString := os.Getenv("FS_ARGS")
if envArgsString != "" && runtime.GOOS != "windows" {
envArgs := strings.Split(envArgsString, " ")
flag.CommandLine.Parse(envArgs)
os.Unsetenv("FS_ARGS")
} else {
flag.Parse()
}
SetLanguage()
}