Documentation ¶
Index ¶
- Constants
- Variables
- func AddPluginCommands(ctx context.Context, base *cobra.Command, plugins []Metadata)
- func CallPluginExecutable(ctx context.Context, main string, argv []string, ...) error
- func Decode(encoded string) ([]byte, error)
- func Encode(path string) string
- func SetPluginCommand(log log.Logger, cobraCmd *cobra.Command, args []string)
- func SetPlugins(p []Metadata)
- type Binary
- type Command
- type Completion
- type Dependency
- type Hook
- type Installer
- type Interface
- type Metadata
- type NewestVersionError
Constants ¶
View Source
const ( SessionEnv = "ANKOR_PLUGIN_SESSION" ExecutionIDEnv = "ANKOR_PLUGIN_EXECUTION_ID" OsArgsEnv = "ANKOR_PLUGIN_OS_ARGS" CommandEnv = "ANKOR_PLUGIN_COMMAND" CommandLineEnv = "ANKOR_PLUGIN_COMMAND_LINE" )
View Source
const PluginCommandAnnotation = "github.com/is-plugin"
Variables ¶
View Source
var PluginBinary = "binary"
Functions ¶
func AddPluginCommands ¶
func CallPluginExecutable ¶
func CallPluginExecutable(ctx context.Context, main string, argv []string, extraEnvVars map[string]string, out io.Writer) error
CallPluginExecutable is used to set up the environment for the plugin and then call the executable specified by the parameter 'main'
func SetPluginCommand ¶
func SetPlugins ¶
func SetPlugins(p []Metadata)
Types ¶
type Command ¶
type Command struct { // SubCommand is the sub command of ankor this command should be added to SubCommand string `json:"subCommand,omitempty"` // Name is the name of the command Name string `json:"name"` // Usage is the single-line usage text shown in help Usage string `json:"usage"` // Description is a long description shown Description string `json:"description"` // BaseArgs that will be prepended to all supplied user flags for this plugin command BaseArgs []string `json:"baseArgs,omitempty"` }
type Completion ¶ added in v0.3.8
func NewCompletion ¶ added in v0.3.8
func NewCompletion(cmd *cobra.Command, args []string) Completion
type Dependency ¶
type Hook ¶
type Hook struct { // Event is the name of the event when to execute this hook Event string `json:"event"` // Background specifies if the given command should be executed in the background Background bool `json:"background"` // BaseArgs that will be prepended to all supplied user flags for this plugin command BaseArgs []string `json:"baseArgs,omitempty"` }
type Installer ¶
type Installer interface { DownloadMetadata(path, version string) (*Metadata, error) DownloadBinary(name, metadataPath, version, binaryPath, outFile string) error }
func NewInstaller ¶
type Interface ¶
type Metadata ¶
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"` // Binaries holds the binary to download for the // given os & arch Binaries []Binary `json:"binaries,omitempty"` // Commands are the commands that will be added to ankor Commands []Command `json:"commands,omitempty"` // Hooks list of dependencies required by the plugin Dependencies []Dependency `json:"dependencies,omitempty"` // This will be filled after parsing the metadata PluginFolder string `json:"pluginFolder,omitempty"` // Hooks are commands that will be executed at specific events Hooks []Hook `json:"hooks,omitempty"` }
type NewestVersionError ¶
type NewestVersionError struct {
// contains filtered or unexported fields
}
func (*NewestVersionError) Error ¶
func (n *NewestVersionError) Error() string
Click to show internal directories.
Click to hide internal directories.