func HandleCommand(handler PluginHandler, args []string) error
HandleCommand receives a PluginHandler and command-line arguments and attempts to find a plugin executable on the PATH that satisfies the given arguments.
ExecHandler implements PluginHandler using the "os/exec" package.
type ExecHandler struct { Prefix string Exec execFunc }
func NewExecHandler(prefix string) *ExecHandler
NewExecHandler creates and returns a new ExecHandler configured with the prefix.
func (h *ExecHandler) Execute(filename string, args, env []string) error
Execute implements PluginHandler.Execute
func (h *ExecHandler) Lookup(command string) string
Lookup implements PluginHandler, using https://golang.org/pkg/os/exec/#LookPath to search for the command.
PluginHandler provides functionality for finding and executing external plugins.
type PluginHandler interface { // Lookup should return the full path to an executable for the provided // command, or "" if no matching command can be found. Lookup(command string) string // Execute should execute the provided path, passing in the args and env. Execute(filename string, args, env []string) error }