feat: 更新 enum 命令的帮助文档,增加详细的标志和行为说明
This commit is contained in:
@@ -16,9 +16,28 @@ import (
|
|||||||
|
|
||||||
func CommandGenEnum(root *cobra.Command) {
|
func CommandGenEnum(root *cobra.Command) {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "enum",
|
Use: "enum",
|
||||||
Aliases: []string{"e"},
|
Aliases: []string{"e"},
|
||||||
Short: "Generate enums",
|
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,
|
RunE: commandGenEnumE,
|
||||||
PostRunE: commandGenProviderE,
|
PostRunE: commandGenProviderE,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user