plugins

package
v1.1.0-beta5 Latest Latest
Warning

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

Go to latest
Published: May 5, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handle

func Handle(handler Handler, args []string) error

Handle takes a handler and arguments in order to lookup and run a plugin.

Types

type BinaryPlugin

type BinaryPlugin struct {
	// Where to read input
	In io.Reader

	// Where to write output
	Out io.Writer

	// Write to write error information
	Err io.Writer
	// contains filtered or unexported fields
}

BinaryPlugin is run via an executable binary.

func NewBinaryPlugin

func NewBinaryPlugin(path string) *BinaryPlugin

func (BinaryPlugin) Run

func (bp BinaryPlugin) Run(args []string) error

type Handler

type Handler interface {
	// Lookup takes the name of a plugin and returns a plugin
	// and a bool indicating if it was found
	Lookup(pluginName string) (Plugin, bool)
}

type PathHandler

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

PathHandler attempts to load a plugin from the system path.

func NewPathHandler

func NewPathHandler(prefix string) *PathHandler

func (PathHandler) Lookup

func (ph PathHandler) Lookup(pluginName string) (Plugin, bool)

type Plugin

type Plugin interface {
	// Run takes in the arguments following the plugin name
	// and returns any error that occurred while running
	Run(args []string) error
}

Jump to

Keyboard shortcuts

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