plugin

package
v0.14.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Install is executed after the plugin is added.
	Install = "install"
	// Delete is executed after the plugin is removed.
	Delete = "delete"
	// Update is executed after the plugin is updated.
	Update = "update"
)

Types of hooks

Variables

View Source
var (
	// ErrMissingMetadata indicates that plugin.yaml is missing.
	ErrMissingMetadata = errors.New("plugin metadata (plugin.yaml) missing")
	// ErrExists indicates that a plugin already exists
	ErrExists = errors.New("plugin already exists")
	// ErrDoesNotExist indicates that a plugin does not exist
	ErrDoesNotExist = errors.New("plugin does not exist")
	// ErrHomeMissing indicates that the directory expected to contain plugins does not exist
	ErrHomeMissing = errors.New(`plugin home "$(draft home)/plugins" does not exist`)
	// ErrMissingSource indicates that information about the source of the plugin was not found
	ErrMissingSource = errors.New("cannot get information about plugin source")
	// ErrRepoDirty indicates that the plugin repo was modified
	ErrRepoDirty = errors.New("plugin repo was modified")
	// ErrVersionDoesNotExist indicates that the request version does not exist
	ErrVersionDoesNotExist = errors.New("requested version does not exist")
)

Functions

This section is empty.

Types

type Builtin

type Builtin struct {
	Name    string
	URL     string
	Version string
}

Builtin contains metadata to the built-in plugins. Used to install/uninstall a plugin.

func Builtins

func Builtins() []*Builtin

Builtins fetches all built-in plugins.

type Downloaders added in v0.14.0

type Downloaders struct {
	// Protocols are the list of schemes from the charts URL.
	Protocols []string `json:"protocols"`
	// Command is the executable path with which the plugin performs
	// the actual download for the corresponding Protocols
	Command string `json:"command"`
}

Downloaders represents the plugins capability if it can retrieve charts from special sources

type Hooks added in v0.14.0

type Hooks map[string]string

Hooks is a map of events to commands.

func (Hooks) Get added in v0.14.0

func (hooks Hooks) Get(event string) string

Get returns a hook for an event.

type Metadata added in v0.14.0

type Metadata struct {
	// Name is the name of the plugin
	Name string `json:"name"`

	// Version is a SemVer 2 version of the plugin.
	Version string `json:"version"`

	// Usage is the single-line usage text shown in help
	Usage string `json:"usage"`

	// Description is a long description shown in places like `helm help`
	Description string `json:"description"`

	// Command is the command, as a single string.
	//
	// The command will be passed through environment expansion, so env vars can
	// be present in this command. Unless IgnoreFlags is set, this will
	// also merge the flags passed from Helm.
	//
	// Note that command is not executed in a shell. To do so, we suggest
	// pointing the command to a shell script.
	Command string `json:"command"`

	// IgnoreFlags ignores any flags passed in from Helm
	//
	// For example, if the plugin is invoked as `helm --debug myplugin`, if this
	// is false, `--debug` will be appended to `--command`. If this is true,
	// the `--debug` flag will be discarded.
	IgnoreFlags bool `json:"ignoreFlags"`

	// UseTunnel indicates that this command needs a tunnel.
	// Setting this will cause a number of side effects, such as the
	// automatic setting of HELM_HOST.
	UseTunnel bool `json:"useTunnel"`

	// PlatformHooks are commands that will run on events based on the platform specified.
	PlatformHooks map[string]Hooks `json:"hooks"`

	// Downloaders field is used if the plugin supply downloader mechanism
	// for special protocols.
	Downloaders []Downloaders `json:"downloaders"`
}

Metadata describes a plugin.

This is the plugin equivalent of a chart.Metadata.

type Plugin added in v0.14.0

type Plugin struct {
	// Metadata is a parsed representation of a plugin.yaml
	Metadata *Metadata
	// Dir is the string path to the directory that holds the plugin.
	Dir string
}

Plugin represents a plugin.

func FindPlugins added in v0.14.0

func FindPlugins(plugdirs string) ([]*Plugin, error)

FindPlugins returns a list of YAML files that describe plugins.

func LoadAll added in v0.14.0

func LoadAll(basedir string) ([]*Plugin, error)

LoadAll loads all plugins found beneath the base directory.

This scans only one directory level.

func LoadDir added in v0.14.0

func LoadDir(dirname string) (*Plugin, error)

LoadDir loads a plugin from the given directory.

func (*Plugin) PrepareCommand added in v0.14.0

func (p *Plugin) PrepareCommand(extraArgs []string) (string, []string)

PrepareCommand takes a Plugin.Command and prepares it for execution.

It merges extraArgs into any arguments supplied in the plugin. It returns the name of the command and an args array.

The result is suitable to pass to exec.Command.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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