From 615889e00e744f76a8e4e1bade2367bde8598878 Mon Sep 17 00:00:00 2001 From: ewy Date: Wed, 22 Apr 2026 17:09:06 +0200 Subject: add "invocation" method which expects a target to output its own magic spell --- model/target.go | 1 + runner/base.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/model/target.go b/model/target.go index 5be97ed..b503381 100644 --- a/model/target.go +++ b/model/target.go @@ -13,6 +13,7 @@ type Target interface { Tags() Tags ShortestId() string Visible() bool + Invocation(src *Source) []string } type HydratedTarget interface { diff --git a/runner/base.go b/runner/base.go index 28ea4d5..7435fd7 100644 --- a/runner/base.go +++ b/runner/base.go @@ -22,6 +22,7 @@ func (t *BaseTarget) Matches(input string) bool { func (t *BaseTarget) ShortestId() string { return t.Reduced } +func (b *BaseTarget) Invocation(src *model.Source) []string { func Hydrated[T model.Target](in T) BaseHydration[T] { return BaseHydration[T]{ @@ -53,6 +54,10 @@ func (b BaseHydration[T]) Hydrate(src *model.Source) (model.HydratedTarget, erro return b, nil } +func (b BaseHydration[T]) Invocation(src *model.Source) []string { + return b.BaseTarget.Invocation(src) +} + func (b BaseHydration[T]) Visible() bool { return b.BaseTarget.Visible() } -- cgit v1.3.1