chore: cli refactor

This commit is contained in:
abelith committed 2026-08-21 16:30:49 +05:00
1 parent 181642172a
commit 99264ca438
8 files changed
+27 -50

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
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
}