Documentation
¶
Index ¶
- Constants
- type Manager
- func (manager *Manager) FindPlugin(parts []string) (Plugin, error)
- func (manager *Manager) HelpTemplateFuncs() *template.FuncMap
- func (manager *Manager) ListPlugins() (PluginList, error)
- func (manager *Manager) ListPluginsForCommandGroup(commandGroupParts []string) (PluginList, error)
- func (manager *Manager) LookupInPath() bool
- func (manager *Manager) PluginsDir() string
- func (manager *Manager) Verify() VerificationErrorsAndWarnings
- type Plugin
- type PluginList
- type VerificationErrorsAndWarnings
- func (eaw *VerificationErrorsAndWarnings) AddError(format string, args ...interface{}) VerificationErrorsAndWarnings
- func (eaw *VerificationErrorsAndWarnings) AddWarning(format string, args ...interface{}) VerificationErrorsAndWarnings
- func (eaw *VerificationErrorsAndWarnings) HasErrors() bool
- func (eaw *VerificationErrorsAndWarnings) IsEmpty() bool
- func (eaw *VerificationErrorsAndWarnings) PrintWarningsAndErrors(out io.Writer)
Constants ¶
const ( UserExecute = 1 << 6 GroupExecute = 1 << 3 OtherExecute = 1 << 0 )
permission bits for execute
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
NewManager creates a new manager for looking up plugins on the file system
func (*Manager) FindPlugin ¶
FindPlugin checks if a plugin for the given parts exist and return it. The args given must not contain any options and contain only the commands (like in [ "source", "github" ] for a plugin called 'kn-source-github' The plugin with the most specific (longest) name is returned or nil if non is found. An error is returned if the lookup fails for some reason like an io error
func (*Manager) HelpTemplateFuncs ¶
HelpTemplateFuncs returns a function map which can be used in templates for resolving plugin related help messages
func (*Manager) ListPlugins ¶
func (manager *Manager) ListPlugins() (PluginList, error)
ListPlugins lists all plugins that can be found in the plugin directory or in the path (if configured)
func (*Manager) ListPluginsForCommandGroup ¶
func (manager *Manager) ListPluginsForCommandGroup(commandGroupParts []string) (PluginList, error)
ListPluginsForCommandGroup lists all plugins that can be found in the plugin directory or in the path (if configured), and which fits to a command group
func (*Manager) LookupInPath ¶
LookupInPath returns true if plugins should be also looked up within the path
func (*Manager) PluginsDir ¶
PluginsDir returns the configured directory holding plugins
func (*Manager) Verify ¶
func (manager *Manager) Verify() VerificationErrorsAndWarnings
Verification of a ll plugins. This method returns all errors and warnings for the verification. The following criteria are verified (for each plugin): * If the plugin is executable * If the plugin is overshadowed by a previous plugin
type Plugin ¶
type Plugin interface { // Get the name of the plugin (the file name without extensions) Name() string // Execute the plugin with the given arguments Execute(args []string) error // Return a description of the plugin (if support by the plugin binary) Description() (string, error) // The command path leading to this plugin. // Eg. for a plugin "kn source github" this will be [ "source", "github" ] CommandParts() []string // Location of the plugin where it is stored in the filesystem Path() string }
Interface describing a plugin
type PluginList ¶
type PluginList []Plugin
Used for sorting a list of plugins
var InternalPlugins PluginList
Allow plugins to register to this slice for inlining
func (PluginList) Len ¶
func (p PluginList) Len() int
func (PluginList) Less ¶
func (p PluginList) Less(i, j int) bool
func (PluginList) Swap ¶
func (p PluginList) Swap(i, j int)
type VerificationErrorsAndWarnings ¶
Collection of errors and warning collected during verifications
func (*VerificationErrorsAndWarnings) AddError ¶
func (eaw *VerificationErrorsAndWarnings) AddError(format string, args ...interface{}) VerificationErrorsAndWarnings
func (*VerificationErrorsAndWarnings) AddWarning ¶
func (eaw *VerificationErrorsAndWarnings) AddWarning(format string, args ...interface{}) VerificationErrorsAndWarnings
func (*VerificationErrorsAndWarnings) HasErrors ¶
func (eaw *VerificationErrorsAndWarnings) HasErrors() bool
func (*VerificationErrorsAndWarnings) IsEmpty ¶
func (eaw *VerificationErrorsAndWarnings) IsEmpty() bool
func (*VerificationErrorsAndWarnings) PrintWarningsAndErrors ¶
func (eaw *VerificationErrorsAndWarnings) PrintWarningsAndErrors(out io.Writer)