plugin

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ValidPluginFilenamePrefixes = []string{"ankor"}

Functions

This section is empty.

Types

type Completion added in v0.3.8

type Completion interface {
	SetupCompletion() error
	SetPlugins(plugins []index.Plugin)
}

func NewCompletion added in v0.3.8

func NewCompletion(path environment.Paths, cmd *cobra.Command, args []string) Completion

type DefaultPluginHandler added in v0.4.0

type DefaultPluginHandler struct {
	ValidPrefixes []string
}

DefaultPluginHandler implements Handler

func NewDefaultPluginHandler added in v0.4.0

func NewDefaultPluginHandler(validPrefixes []string) *DefaultPluginHandler

NewDefaultPluginHandler instantiates the DefaultPluginHandler with a list of given filename prefixes used to identify valid plugin filenames.

func (*DefaultPluginHandler) Execute added in v0.4.0

func (h *DefaultPluginHandler) Execute(executablePath string, cmdArgs, environment []string) error

Execute implements Handler

func (*DefaultPluginHandler) Lookup added in v0.4.0

func (h *DefaultPluginHandler) Lookup(filename string) (string, bool)

Lookup implements Handler

type Handler added in v0.4.0

type Handler interface {
	// Lookup exists at the given filename, or a boolean false.
	// 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.

type Plugins added in v0.4.0

type Plugins interface {
	List() ([]index.Plugin, error)
	AddPluginCommands() []*cobra.Command
}

func NewPlugin added in v0.4.0

func NewPlugin(ctx context.Context, path environment.Paths) Plugins

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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