plugin

package
v0.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 8, 2026 License: BSD-3-Clause Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllTemplateVariables

func GetAllTemplateVariables(context map[string]string) map[string]string

GetAllTemplateVariables collects template variables from all registered plugins

func Register

func Register(p Plugin)

Register adds a plugin to the global registry

func RegisterTemplateProvider

func RegisterTemplateProvider(provider TemplateProvider)

RegisterTemplateProvider adds a template provider to the global registry

Types

type Plugin

type Plugin interface {
	// Name returns the name of the plugin
	Name() string

	// Types returns the set of plugin types this plugin implements.
	// Type names match interface names for reflective discovery.
	Types() PluginTypeSet
}

Plugin is the base interface all plugins must implement

func GetPlugins

func GetPlugins() []Plugin

GetPlugins returns all registered plugins

func GetPluginsByType

func GetPluginsByType(pluginType PluginType) []Plugin

GetPluginsByType returns all plugins that implement a specific type

type PluginType

type PluginType string

PluginType represents the type of plugin capability. Values match interface names for reflective discovery.

const (
	// TypeVCS indicates a version control system plugin
	TypeVCS PluginType = "VCS"

	// TypeTemplateProvider indicates a plugin that provides template variables
	TypeTemplateProvider PluginType = "TemplateProvider"

	// TypeOutput indicates an output format plugin
	TypeOutput PluginType = "Output"

	// TypeHook indicates a lifecycle hook plugin
	TypeHook PluginType = "Hook"
)

type PluginTypeSet

type PluginTypeSet map[PluginType]struct{}

PluginTypeSet represents a set of plugin types

func NewPluginTypeSet

func NewPluginTypeSet(types ...PluginType) PluginTypeSet

NewPluginTypeSet creates a new set from the given types

func (PluginTypeSet) Contains

func (s PluginTypeSet) Contains(t PluginType) bool

Contains checks if the set contains the given type

func (PluginTypeSet) Slice

func (s PluginTypeSet) Slice() []PluginType

Slice returns the types as a slice

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry holds all registered plugins

type TemplateProvider

type TemplateProvider interface {
	Plugin

	// GetTemplateVariables returns plugin-specific template variables
	// The context map provides access to existing variables the plugin might need
	// (e.g., ShortHash for creating prefixed hash variables)
	GetTemplateVariables(context map[string]string) map[string]string
}

TemplateProvider is an interface for plugins that can provide template variables

func GetTemplateProviders

func GetTemplateProviders() []TemplateProvider

GetTemplateProviders returns all registered template providers

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL