Merge pull request #429 from LTP414/dev

Get commandline from ENV
This commit is contained in:
ZacharyZcR 2025-02-15 05:00:32 +08:00 committed by GitHub
commit 3e04e7801f
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()
}