plugin

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2019 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//
	OpenPluginError = xrr.Xrror("Unable to open plugin at %s:\n\t%s").Out
	//
	DoesntExistError = xrr.Xrror("Plugin at %s has no %s.").Out
)
View Source
var Core *loader = &loader{
	"core",
	func(l *loader) error {
		if l.loaded == nil {
			l.loaded = make(map[string]pluginCmd)
			for k, fn := range core.Core {
				l.loaded[k] = fn
			}
		}
		return nil
	},
	func(l *loader) (map[string][]string, error) {
		l.Load()
		ret := make(map[string][]string)
		var res []string
		for k, _ := range l.loaded {
			res = append(res, k)
		}
		ret["core"] = res
		return ret, nil
	},
	nil,
}

A customised always loaded Loader encapsulating core functionality

View Source
var PluginDoesNotExistError = xrr.Xrror("plugin does not exist: %s").Out

An error indicating the named plugin does not exist.

Functions

func New

func New(dirs ...string) (*loaders, error)

Provides a new, multiple directory handling Loader.

Types

type Loader

type Loader interface {
	AddDir(string) error
	Load() error
	Plugins() (map[string][]string, error)
	Get(...string) ([]flip.Command, error)
}

An interface for plugin loading.

Jump to

Keyboard shortcuts

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