{"modulePath":"github.com/warpcloud/helm","version":"v0.0.0-20190621033618-eef33a99f758","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package plugin\n\n## Constants\n\n```go\nconst (\n\t// Install is executed after the plugin is added.\n\tInstall = \"install\"\n\t// Delete is executed after the plugin is removed.\n\tDelete = \"delete\"\n\t// Update is executed after the plugin is updated.\n\tUpdate = \"update\"\n)\n```\nTypes of hooks\n\n## Functions\n\n```go\nfunc SetupPluginEnv(settings helm_env.EnvSettings,\n\tshortName, base string)\n```\nSetupPluginEnv prepares os.Env for plugins. It operates on os.Env because the plugin subsystem itself needs access to the environment variables created here.\n\n## Types\n\n```go\ntype Downloaders struct {\n\t// Protocols are the list of schemes from the charts URL.\n\tProtocols []string `json:\"protocols\"`\n\t// Command is the executable path with which the plugin performs\n\t// the actual download for the corresponding Protocols\n\tCommand string `json:\"command\"`\n}\n```\nDownloaders represents the plugins capability if it can retrieve charts from special sources\n\n```go\ntype Hooks map[string]string\n```\nHooks is a map of events to commands.\n\n```go\ntype Metadata struct {\n\t// Name is the name of the plugin\n\tName string `json:\"name\"`\n\n\t// Version is a SemVer 2 version of the plugin.\n\tVersion string `json:\"version\"`\n\n\t// Usage is the single-line usage text shown in help\n\tUsage string `json:\"usage\"`\n\n\t// Description is a long description shown in places like `helm help`\n\tDescription string `json:\"description\"`\n\n\t// Command is the command, as a single string.\n\t//\n\t// The command will be passed through environment expansion, so env vars can\n\t// be present in this command. Unless IgnoreFlags is set, this will\n\t// also merge the flags passed from Helm.\n\t//\n\t// Note that command is not executed in a shell. To do so, we suggest\n\t// pointing the command to a shell script.\n\t//\n\t// The following rules will apply to processing commands:\n\t// - If platformCommand is present, it will be searched first\n\t// - If both OS and Arch match the current platform, search will stop and the command will be executed\n\t// - If OS matches and there is no more specific match, the command will be executed\n\t// - If no OS/Arch match is found, the default command will be executed\n\t// - If no command is present and no matches are found in platformCommand, Helm will exit with an error\n\tPlatformCommand []PlatformCommand `json:\"platformCommand\"`\n\tCommand         string            `json:\"command\"`\n\n\t// IgnoreFlags ignores any flags passed in from Helm\n\t//\n\t// For example, if the plugin is invoked as `helm --debug myplugin`, if this\n\t// is false, `--debug` will be appended to `--command`. If this is true,\n\t// the `--debug` flag will be discarded.\n\tIgnoreFlags bool `json:\"ignoreFlags\"`\n\n\t// Hooks are commands that will run on events.\n\tHooks Hooks\n\n\t// Downloaders field is used if the plugin supply downloader mechanism\n\t// for special protocols.\n\tDownloaders []Downloaders `json:\"downloaders\"`\n}\n```\nMetadata describes a plugin.\n\nThis is the plugin equivalent of a chart.Metadata.\n\n```go\ntype PlatformCommand struct {\n\tOperatingSystem string `json:\"os\"`\n\tArchitecture    string `json:\"arch\"`\n\tCommand         string `json:\"command\"`\n}\n```\nPlatformCommand represents a command for a particular operating system and architecture\n\n```go\ntype Plugin struct {\n\t// Metadata is a parsed representation of a plugin.yaml\n\tMetadata *Metadata\n\t// Dir is the string path to the directory that holds the plugin.\n\tDir string\n}\n```\nPlugin represents a plugin.\n\n```go\nfunc FindPlugins(plugdirs string) ([]*Plugin, error)\n```\nFindPlugins returns a list of YAML files that describe plugins.\n\n```go\nfunc LoadAll(basedir string) ([]*Plugin, error)\n```\nLoadAll loads all plugins found beneath the base directory.\n\nThis scans only one directory level.\n\n```go\nfunc LoadDir(dirname string) (*Plugin, error)\n```\nLoadDir loads a plugin from the given directory.\n\n```go\nfunc (p *Plugin) PrepareCommand(extraArgs []string) (string, []string, error)\n```\nPrepareCommand takes a Plugin.PlatformCommand.Command, a Plugin.Command and will applying the following processing: - If platformCommand is present, it will be searched first - If both OS and Arch match the current platform, search will stop and the command will be prepared for execution - If OS matches and there is no more specific match, the command will be prepared for execution - If no OS/Arch match is found, the default command will be prepared for execution - If no command is present and no matches are found in platformCommand, will exit with an error\n\nIt merges extraArgs into any arguments supplied in the plugin. It returns the name of the command and an args array.\n\nThe result is suitable to pass to exec.Command.\n\n","path":"github.com/warpcloud/helm/pkg/plugin","name":"plugin","synopsis":"","isRedistributable":true}
