- main
chore
- minor changes
This commit is contained in:
abelith committed 2026-08-04 01:16:32 +05:00
1 parent 213562956c
commit e4737ca179
10 files changed
+89 -24

No files matched your search

+1 -1
View File
@@ -5,9 +5,9 @@ import (
"context"
"errors"
"fmt"
"github.com/abelith/spellbook/internal/models"
"github.com/google/shlex"
"os/exec"
"spellbook/internal/models"
"text/template"
"time"
)
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"context"
"database/sql"
"fmt"
"spellbook/internal/models"
"github.com/abelith/spellbook/internal/models"
"strings"
)
+9 -1
View File
@@ -2,7 +2,7 @@ package application
import (
"context"
"spellbook/internal/models"
"github.com/abelith/spellbook/internal/models"
)
type SpellCaster interface {
@@ -25,6 +25,14 @@ type Application struct {
spellQuery SpellQuery
}
func NewApplication(caster SpellCaster, cmd SpellCommand, query SpellQuery) *Application {
return &Application{
caster: caster,
spellCmd: cmd,
spellQuery: query,
}
}
func (a *Application) AddSpell(
ctx context.Context,
spell models.Spell,
+1 -1
View File
@@ -1,8 +1,8 @@
package cli
import (
"github.com/abelith/spellbook/internal/models"
"github.com/spf13/cobra"
"spellbook/internal/models"
"strings"
)
+2 -1
View File
@@ -2,10 +2,10 @@ package cli
import (
"context"
"github.com/abelith/spellbook/internal/models"
"github.com/olekukonko/tablewriter"
"github.com/spf13/cobra"
"os"
"spellbook/internal/models"
"strings"
)
@@ -63,6 +63,7 @@ func listCommands(ctx context.Context, cmd *cobra.Command, app Application) erro
if len(spells) == 0 {
cmd.Println("Spell book is empty. Try `spellbook add` to add your first spell")
return nil
}
return printTable(cmd, spells)
-14
View File
@@ -1,14 +0,0 @@
package handlers
import (
"context"
"spellbook/internal/models"
)
type Application interface {
AddSpell(ctx context.Context, spell models.Spell) error
GetSpell(ctx context.Context, spellName string) (models.Spell, error)
GetSpells(ctx context.Context, query models.SearchQuery) ([]models.Spell, error)
DeleteSpell(ctx context.Context, spellName string) error
CastSpell(ctx context.Context, spellCast models.SpellCast) (models.CastResult, error)
}