Documentation
¶
Index ¶
Constants ¶
const BinaryPrefix = "orca-plugin-"
BinaryPrefix is the filename prefix every plugin executable must have.
Variables ¶
var ErrKilled = errors.New("plugin manager has been killed")
ErrKilled is returned when trying to load a plugin after Kill has been called.
Functions ¶
func BuildCommands ¶
func BuildCommands(provider plugin.CommandProvider, specs []plugin.CommandSpec) []*cobra.Command
BuildCommands converts a plugin's command specs into cobra commands that call back into the plugin when run.
Types ¶
type ExitError ¶
ExitError is returned when a plugin command fails, so orca can exit with the plugin's exit code.
type LoadedPlugin ¶
type LoadedPlugin struct {
Name string
Path string
Provider plugin.CommandProvider
Commands []plugin.CommandSpec
}
LoadedPlugin is a running plugin process, along with the commands it provides.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) Kill ¶
func (m *Manager) Kill()
Kill stops all plugin processes, and prevents any more from being started. It must be called before orca exits, and is safe to call multiple times or concurrently.
func (*Manager) Load ¶
func (m *Manager) Load(paths []string) []LoadedPlugin
Load starts each plugin binary and fetches its commands. A plugin that fails to start is logged and skipped, so a broken plugin never stops orca from running.
func (*Manager) Loaded ¶
func (m *Manager) Loaded() []LoadedPlugin