plugin

package
v0.56.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// XDGDataHome is the directory to search for data files in the XDG spec
	XDGDataHome = "XDG_DATA_HOME"

	// XDGDataDirs defines an additional list of directories which can be searched for data files
	XDGDataDirs = "XDG_DATA_DIRS"
)

Variables

This section is empty.

Functions

func CacheDirectory added in v0.22.0

func CacheDirectory() string

CacheDirectory returns the full path to the cache directory where all of the plugins are stored.

func Install added in v0.22.0

func Install(ctx context.Context, source string) error

Install installs the plugin to the host machine from either a path on the file system, or a URL. A configuration file must be present and valid at the source in order for the installation to complete successfully.

If the installation is successful, the plugin will be saved to the plugin cache inside of a folder named the same name of the plugin as defined in the plugins configuration file.

Types

type Plugin

type Plugin struct {
	Name        string `yaml:"name"`
	Version     string `yaml:"version"`
	Usage       string `yaml:"usage"`
	Description string `yaml:"description"`
	Command     string `yaml:"command"`
}

Plugin represents a plugin.

func FindAll added in v0.22.0

func FindAll() ([]*Plugin, error)

FindAll finds all of the plugins available on the local file system.

func FromDirectory added in v0.22.0

func FromDirectory(directory string) (*Plugin, error)

FromDirectory returns a plugin from a specific directory.

The given directory must contain a plugin configuration file in order to return successfully.

func Load added in v0.22.0

func Load(name string) (*Plugin, error)

Load loads a plugin given the name of the plugin. The name of the plugin is defined in the plugin configuration and is stored in a folder with the name of the plugin.

func (*Plugin) Directory added in v0.22.0

func (p *Plugin) Directory() string

Directory returns the full path of the directory where the plugin is stored in the plugin cache.

func (*Plugin) Exec

func (p *Plugin) Exec(ctx context.Context, args []string) error

Exec executes the command defined by the plugin along with any arguments.

Arguments that are passed into Exec will be added after any arguments that are defined in the plugins configuration.

Jump to

Keyboard shortcuts

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