plugin

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPluginsDir

func GetPluginsDir() (string, error)

GetPluginsDir returns the plugins directory path

func IsPluginInstalled

func IsPluginInstalled(pluginName string) (bool, error)

IsPluginInstalled checks if a plugin is installed

func RemovePlugin

func RemovePlugin(pluginName string) error

RemovePlugin removes an installed plugin

Types

type Manifest

type Manifest struct {
	Metadata Metadata `yaml:"metadata"`
}

Manifest represents the plugin manifest file

func ListInstalledPlugins

func ListInstalledPlugins() ([]*Manifest, error)

ListInstalledPlugins lists all installed plugins

func LoadManifest

func LoadManifest(path string) (*Manifest, error)

LoadManifest loads a plugin manifest from a file

type Metadata

type Metadata struct {
	Name        string   `yaml:"name"`
	Version     string   `yaml:"version"`
	Description string   `yaml:"description"`
	Author      string   `yaml:"author"`
	Homepage    string   `yaml:"homepage,omitempty"`
	License     string   `yaml:"license,omitempty"`
	Tags        []string `yaml:"tags,omitempty"`
	ToolName    string   `yaml:"tool_name"`              // The tool this plugin supports
	ConfigPath  string   `yaml:"config_path,omitempty"`  // Optional: single custom config path (default: auto-detected)
	ConfigPaths []string `yaml:"config_paths,omitempty"` // Optional: multiple config paths
}

Metadata represents plugin metadata

type Plugin

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

	// Version returns the plugin version
	Version() string

	// Description returns a short description
	Description() string

	// Initialize initializes the plugin
	Initialize() error

	// Snapshot creates a snapshot for this plugin's tool
	Snapshot(destPath string) error

	// Restore restores from a snapshot
	Restore(sourcePath string) error

	// Validate validates a snapshot
	Validate(snapshotPath string) error

	// IsInstalled checks if the tool is installed
	IsInstalled() bool

	// GetMetadata returns metadata about the current state
	GetMetadata() (map[string]interface{}, error)
}

Plugin represents a plugin that extends envswitch functionality

Jump to

Keyboard shortcuts

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