From 5474d7467f4208f62c95d363613727dde830a744 Mon Sep 17 00:00:00 2001 From: luoxin Date: Wed, 1 Jan 2025 18:18:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=81=E8=AE=B8=E6=8C=87=E5=AE=9A=20gen=20to?= =?UTF-8?q?=20=E8=87=AA=E5=8A=A8=E7=BB=99=20model?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cli/gen/gen_add_rpc.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cli/gen/gen_add_rpc.go b/cli/gen/gen_add_rpc.go index 28bbf69..3fdd181 100644 --- a/cli/gen/gen_add_rpc.go +++ b/cli/gen/gen_add_rpc.go @@ -26,7 +26,11 @@ var addRpcCmd = &cobra.Command{ } var msg *codegen.PbMessage - if v, err := cmd.Flags().GetString("model"); err == nil && v != "" { + if v, err := cmd.Flags().GetString("model"); err == nil && (v != "" || opt.GenTo != "") { + if v == "" { + v = opt.GenTo + } + // 先看一下加了 Model 的 时候存在 { model := stringx.ToSnake(v)