diff --git a/init.go b/init.go index 3b4f1df..9fdb0e6 100644 --- a/init.go +++ b/init.go @@ -13,6 +13,7 @@ import ( "github.com/caarlos0/env/v9" "github.com/jessevdk/go-flags" "github.com/joho/godotenv" + "os" ) // Init 初始化配置 @@ -65,7 +66,8 @@ func parseCliParam(cliReceiver any) error { return nil } // 解析命令行参数 - if _, err := flags.Parse(cliReceiver); nil != err { + parser := flags.NewParser(cliReceiver, flags.Default) + if _, err := parser.ParseArgs(os.Args[1:]); nil != err { return errors.New("cli param parse fail : " + err.Error()) } return nil