Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandlePluginCommand ¶
HandlePluginCommand receives a pluginHandler and command-line arguments and attempts to find a plugin executable that satisfies the given arguments.
Types ¶
type DefaultHandler ¶
type DefaultHandler struct {
ValidPrefixes []string
}
DefaultHandler implements Handler
func NewDefaultHandler ¶
func NewDefaultHandler(validPrefixes []string) *DefaultHandler
NewDefaultHandler creates a new default plugin handler
type Handler ¶
type Handler interface {
// Lookup searches for a plugin executable with the given filename
// and returns its full path if found, or a boolean false if not found.
// Lookup will iterate over a list of given prefixes
// in order to recognize valid plugin filenames.
// The first filepath to match a prefix is returned.
Lookup(filename string) (string, bool)
// Execute receives an executable's filepath, a slice
// of arguments, and a slice of environment variables
// to relay to the executable.
Execute(executablePath string, cmdArgs, environment []string) error
}
Handler is capable of parsing command line arguments and performing executable filename lookups to search for valid plugin files, and execute found plugins.
Click to show internal directories.
Click to hide internal directories.