From 8e59c8f09c172c822a9ce098d38085a4f814582f Mon Sep 17 00:00:00 2001 From: LTP414 <198364671+LTP414@users.noreply.github.com> Date: Sun, 9 Feb 2025 00:15:41 +0800 Subject: [PATCH] Get commandline from ENV --- Common/Flag.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Common/Flag.go b/Common/Flag.go index 54df9f5..4553be8 100644 --- a/Common/Flag.go +++ b/Common/Flag.go @@ -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() }