diff --git a/provider.go b/provider.go index 10ca6d7..92abdff 100644 --- a/provider.go +++ b/provider.go @@ -3,7 +3,13 @@ package step import "html/template" // Provider is an object which provides extra functionality to an environment. -type Provider any +type Provider interface { + // Package returns the package identifier of the provider. For example: + // git.tebibyte.media/sashakoshka/step/examples/testplugin. The only + // exception is providers within the providers sub-package, which just + // return their basename. + Package () string +} // Configurable is an object that can be configured according to metadata. type Configurable interface { diff --git a/providers/http/http.go b/providers/http/http.go index 641ea05..687b96a 100644 --- a/providers/http/http.go +++ b/providers/http/http.go @@ -12,6 +12,11 @@ type Provider struct { } +// Package fulfills the step.Provider interface. +func (this *Provider) Package () string { + return "http" +} + // FuncMap fulfills the step.FuncProvider interface. func (this *Provider) FuncMap () template.FuncMap { return template.FuncMap { diff --git a/providers/import/import.go b/providers/import/import.go index 3f0cecd..36335e3 100644 --- a/providers/import/import.go +++ b/providers/import/import.go @@ -13,9 +13,9 @@ type Provider struct { } -// FuncMap fulfills the step.FuncProvider interface. -func (this *Provider) FuncMap () template.FuncMap { - return nil +// Package fulfills the step.Provider interface. +func (this *Provider) Package () string { + return "import" } // FuncMapFor fulfills the step.FuncProviderFor interface. diff --git a/providers/markdown/markdown.go b/providers/markdown/markdown.go index b0a9b8a..8b44e48 100644 --- a/providers/markdown/markdown.go +++ b/providers/markdown/markdown.go @@ -20,6 +20,11 @@ type Provider struct { RendererOptions []renderer.Option } +// Package fulfills the step.Provider interface. +func (this *Provider) Package () string { + return "markdown" +} + // Default returns a provider with the default configuration. func Default () *Provider { return &Provider { diff --git a/providers/math/math.go b/providers/math/math.go index cc1997d..a6b2112 100644 --- a/providers/math/math.go +++ b/providers/math/math.go @@ -11,6 +11,11 @@ type Provider struct { } +// Package fulfills the step.Provider interface. +func (this *Provider) Package () string { + return "math" +} + // FuncMap fulfills the step.FuncProvider interface. func (this *Provider) FuncMap () template.FuncMap { return template.FuncMap { diff --git a/providers/mime/mime.go b/providers/mime/mime.go index ffdf80c..d78f63d 100644 --- a/providers/mime/mime.go +++ b/providers/mime/mime.go @@ -6,16 +6,16 @@ import "git.tebibyte.media/sashakoshka/step" const hiddenPrefix = "." -var _ step.FuncProvider = new(Provider) +var _ step.FuncProviderFor = new(Provider) // Provider provides MIME functions. type Provider struct { } -// FuncMap fulfills the step.FuncProvider interface. -func (this *Provider) FuncMap () template.FuncMap { - return nil +// Package fulfills the step.Provider interface. +func (this *Provider) Package () string { + return "mime" } // FuncMapFor fulfills the step.FuncProviderFor interface. diff --git a/providers/os/os.go b/providers/os/os.go index 8c0be22..2beeead 100644 --- a/providers/os/os.go +++ b/providers/os/os.go @@ -13,9 +13,9 @@ type Provider struct { } -// FuncMap fulfills the step.FuncProvider interface. -func (this *Provider) FuncMap () template.FuncMap { - return nil +// Package fulfills the step.Provider interface. +func (this *Provider) Package () string { + return "os" } // FuncMapFor fulfills the step.FuncProviderFor interface. diff --git a/providers/path/path.go b/providers/path/path.go index 299eb2f..84aa0ee 100644 --- a/providers/path/path.go +++ b/providers/path/path.go @@ -15,6 +15,11 @@ type Provider struct { } +// Package fulfills the step.Provider interface. +func (this *Provider) Package () string { + return "path" +} + // FuncMap fulfills the step.FuncProvider interface. func (this *Provider) FuncMap () template.FuncMap { return template.FuncMap { diff --git a/providers/slice/slice.go b/providers/slice/slice.go index 2f90a58..23256ac 100644 --- a/providers/slice/slice.go +++ b/providers/slice/slice.go @@ -13,6 +13,11 @@ type Provider struct { } +// Package fulfills the step.Provider interface. +func (this *Provider) Package () string { + return "slice" +} + // FuncMap fulfills the step.FuncProvider interface. func (this *Provider) FuncMap () template.FuncMap { return template.FuncMap { diff --git a/providers/sprig/sprig.go b/providers/sprig/sprig.go index 13c51dd..e31d757 100644 --- a/providers/sprig/sprig.go +++ b/providers/sprig/sprig.go @@ -11,6 +11,11 @@ type Provider struct { } +// Package fulfills the step.Provider interface. +func (this *Provider) Package () string { + return "sprig" +} + // FuncMap fulfills the step.FuncProvider interface. func (this *Provider) FuncMap () template.FuncMap { return sprig.FuncMap()