package cli import ( "github.com/abelith/spellbook/internal/models" "github.com/spf13/cobra" "strings" ) func NewAddCommand(app Application) *cobra.Command { spell := models.Spell{} cmd := &cobra.Command{ Use: "add [flags] -- [spell]", Short: "Add new spell", Long: `WIP`, RunE: func(cmd *cobra.Command, args []string) error { ctx := cmd.Context() spell.Spell = strings.Join(args, " ") return app.AddSpell(ctx, spell) }, } cmd.Flags().StringVarP(&spell.Name, "name", "n", "", "Spell name") cmd.Flags().StringSliceVarP(&spell.Tags, "tags", "t", nil, "Spell tags") cmd.Flags().StringVarP(&spell.ShortDesc, "desc", "d", "", "Short spell description") return cmd }