feat(04-01): generate model, migration, and command artifacts
Add make:model, make:migration and make:command with plugin-id inference, duplicate rejection, and a deterministic registry refresh that leaves handwritten plugin.go untouched. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -26,6 +26,8 @@ type Flag struct {
|
||||
Shorthand string
|
||||
Description string
|
||||
Default string
|
||||
// Bare allows --flag without a value; cobra stores "true".
|
||||
Bare bool
|
||||
}
|
||||
|
||||
// Arg describes a positional argument.
|
||||
|
||||
@@ -65,9 +65,14 @@ func wrap(c Command, out Output) (*cobra.Command, error) {
|
||||
for _, flag := range c.Flags {
|
||||
if flag.Shorthand != "" {
|
||||
cmd.Flags().StringP(flag.Name, flag.Shorthand, flag.Default, flag.Description)
|
||||
continue
|
||||
} else {
|
||||
cmd.Flags().String(flag.Name, flag.Default, flag.Description)
|
||||
}
|
||||
if flag.Bare {
|
||||
if f := cmd.Flags().Lookup(flag.Name); f != nil {
|
||||
f.NoOptDefVal = "true"
|
||||
}
|
||||
}
|
||||
cmd.Flags().String(flag.Name, flag.Default, flag.Description)
|
||||
}
|
||||
return cmd, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user