From 3ea314dc09bdcde5982f814bb2805548f340bf5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Fri, 8 Nov 2024 16:56:54 +0800 Subject: [PATCH] fix --- init.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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