feat(cli): 添加 -g 短参数用于生成默认配置

--generate-config 的短参数形式,便于快速生成配置文件

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
xfy 2026-04-10 18:29:42 +08:00
parent 76c2a6028c
commit e7ee9e717d

View File

@ -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))
}