Files
spellbook/cmd/rm.go
T
2026-08-21 16:30:49 +05:00

27 lines
497 B
Go

package cmd
import (
"fmt"
"github.com/abelith/spellbook/internal/errors"
"github.com/spf13/cobra"
)
func NewRmCommand(app Application) *cobra.Command {
cmd := &cobra.Command{
Use: "rm [spell_name]",
Short: "Delete spell",
Long: "WIP",
RunE: func(cmd *cobra.Command, args []string) error {
ctx := cmd.Context()
if len(args) < 1 {
return fmt.Errorf("%w: %s", errors.ErrInsufficientArgs, "spell_name")
}
return app.DeleteSpell(ctx, args[0])
},
}
return cmd
}