feat: 更新 enum 命令的帮助文档,增加详细的标志和行为说明

This commit is contained in:
Rogee
2025-09-12 10:24:30 +08:00
parent 3a61b6e22b
commit a96df4d628

View File

@@ -19,6 +19,25 @@ func CommandGenEnum(root *cobra.Command) {
Use: "enum",
Aliases: []string{"e"},
Short: "Generate enums",
Long: `Generate enums from Go files that contain both ENUM(...) and swagger:enum.
Scans the project (recursively) for matching files and writes a corresponding
*.gen.go per file with helpers.
Flags:
- -f, --flag Generate flag.Value support (default: true)
- -m, --marshal Generate JSON marshal/unmarshal methods
- -s, --sql Generate database/sql helpers (int, null types) (default: true)
Behavior:
- Always generates Names() and Values()
- With --marshal: adds JSON encoding/decoding
- With --flag: adds flag.Value support
- With --sql: adds SQL driver, int, NullInt, NullString helpers
Examples:
atomctl gen enum -m -s
atomctl gen enum --flag=false`,
RunE: commandGenEnumE,
PostRunE: commandGenProviderE,
}