feat: 增强命令帮助文档,添加详细说明和示例

This commit is contained in:
Rogee
2025-09-12 10:33:57 +08:00
parent a96df4d628
commit ee15e0932a
17 changed files with 217 additions and 52 deletions

View File

@@ -3,11 +3,18 @@ package cmd
import "github.com/spf13/cobra"
func CommandGen(root *cobra.Command) {
cmd := &cobra.Command{
Use: "gen",
Short: "Generate code",
PersistentPostRunE: commandFmtE,
}
cmd := &cobra.Command{
Use: "gen",
Short: "Generate code",
Long: `代码生成命令组:包含 route、provider、model、enum、service 等。
持久化参数:
- -c, --config 数据库配置文件(默认 config.toml供 gen model 使用
说明:
- 子命令执行完成后会自动运行 atomctl fmt 进行格式化`,
PersistentPostRunE: commandFmtE,
}
cmd.PersistentFlags().StringP("config", "c", "config.toml", "database config file")
cmds := []func(*cobra.Command){