Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleCommand ¶
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.
Types ¶
type ExecHandler ¶
type ExecHandler struct {
Prefix string
Exec execFunc
}
ExecHandler implements PluginHandler using the "os/exec" package.
func NewExecHandler ¶
func NewExecHandler(prefix string) *ExecHandler
NewExecHandler creates and returns a new ExecHandler configured with the prefix.
func (*ExecHandler) Execute ¶
func (h *ExecHandler) Execute(filename string, args, env []string) error
Execute implements PluginHandler.Execute
func (*ExecHandler) Lookup ¶
func (h *ExecHandler) Lookup(command string) string
Lookup implements PluginHandler, using https://golang.org/pkg/os/exec/#LookPath to search for the command.
type PluginHandler ¶
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
}
PluginHandler provides functionality for finding and executing external plugins.
Click to show internal directories.
Click to hide internal directories.