chore: cli refactor
This commit is contained in:
1 parent
181642172a
commit
99264ca438
8 files changed
+27
-50
No files matched your search
@@ -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
|
||||
}
|
||||
Reference in new issue
Block a user