plugin

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCommand

func CreateCommand(p Plugin, cfg *config.Config) *cobra.Command

CreateCommand creates a cobra command for a plugin

Types

type ConfigurablePlugin added in v0.15.0

type ConfigurablePlugin interface {
	// SetConfig allows plugins to store config for use in subcommands
	SetConfig(cfg *config.Config)
}

ConfigurablePlugin is an optional interface for plugins that need access to config in subcommands

type FlaggablePlugin

type FlaggablePlugin interface {
	Plugin
	// SetupFlags allows plugins to add custom flags to their command
	SetupFlags(cmd *cobra.Command)
}

FlaggablePlugin is an optional interface for plugins that need custom flags

type Plugin

type Plugin interface {
	// Name returns the name of the plugin (used as command name)
	Name() string
	// Description returns a short description of the plugin
	Description() string
	// Execute runs the plugin with the given configuration
	Execute(config *config.Config) error
}

Plugin defines the interface that all plugins must implement

type Registry

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

Registry holds all registered plugins

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new plugin registry

func (*Registry) GetPlugins

func (r *Registry) GetPlugins() []Plugin

GetPlugins returns all registered plugins

func (*Registry) Register

func (r *Registry) Register(p Plugin)

Register adds a plugin to the registry

Jump to

Keyboard shortcuts

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