From e7ee9e717df6cb6cbc2d51dff38a0cb74a1c2c81 Mon Sep 17 00:00:00 2001 From: xfy Date: Fri, 10 Apr 2026 18:29:42 +0800 Subject: [PATCH] =?UTF-8?q?feat(cli):=20=E6=B7=BB=E5=8A=A0=20-g=20?= =?UTF-8?q?=E7=9F=AD=E5=8F=82=E6=95=B0=E7=94=A8=E4=BA=8E=E7=94=9F=E6=88=90?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --generate-config 的短参数形式,便于快速生成配置文件 Co-Authored-By: Claude Opus 4.6 --- main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 4d10cf8..e8a95ab 100644 --- a/main.go +++ b/main.go @@ -25,6 +25,7 @@ func main() { cfgPath := flag.String("c", "lolly.yaml", "配置文件路径") cfgPathLong := flag.String("config", "", "配置文件路径(长参数)") genConfig := flag.Bool("generate-config", false, "生成默认配置") + genConfigShort := flag.Bool("g", false, "生成默认配置(短参数)") outputPath := flag.String("o", "", "输出文件路径(配合 --generate-config)") showVersion := flag.Bool("v", false, "显示版本") @@ -35,6 +36,7 @@ func main() { if *cfgPathLong != "" { configPath = *cfgPathLong } + generate := *genConfig || *genConfigShort - os.Exit(app.Run(configPath, *genConfig, *outputPath, *showVersion)) + os.Exit(app.Run(configPath, generate, *outputPath, *showVersion)) }