Documentation
¶
Overview ¶
Package command provides command-line interface functionality for Privateer plugins.
Index ¶
- Constants
- Variables
- func Contains(slice []*PluginPkg, search string) bool
- func GeneratePlugin(logger hclog.Logger, templatesDir, sourcePath, outputDir, serviceName string) error
- func GetListCmd(writer Writer) *cobra.Command
- func NewPluginCommands(pluginName, buildVersion, buildGitCommitHash, buildTime string, ...) *cobra.Command
- func ReadConfig()
- func Run(logger hclog.Logger, getPlugins func() []*PluginPkg) (exitCode int)
- func SetBase(cmd *cobra.Command)
- func SetupTemplatingEnvironment(logger hclog.Logger) (templatesDir, sourcePath, outputDir, serviceName string, err error)
- type CatalogData
- type Plugin
- type PluginError
- type PluginErrors
- type PluginPkg
- type Req
- type Writer
Constants ¶
const ( TestPass = iota // TestPass indicates all tests passed. TestFail // TestFail indicates one or more tests failed. Aborted // Aborted indicates execution was aborted. InternalError // InternalError indicates an internal error occurred. BadUsage // BadUsage indicates incorrect command usage. NoTests // NoTests indicates no tests were found to run. )
Exit codes for plugin execution results.
Variables ¶
var ActiveEvaluationOrchestrator *pluginkit.EvaluationOrchestrator
ActiveEvaluationOrchestrator is the currently active evaluation orchestrator.
Functions ¶
func Contains ¶ added in v1.12.0
Contains checks if a plugin with the given name exists in the slice.
func GeneratePlugin ¶ added in v1.12.0
func GeneratePlugin(logger hclog.Logger, templatesDir, sourcePath, outputDir, serviceName string) error
GeneratePlugin generates a plugin from a catalog file.
func GetListCmd ¶ added in v1.12.0
GetListCmd returns the list command that can be added to a root command
func NewPluginCommands ¶
func NewPluginCommands(pluginName, buildVersion, buildGitCommitHash, buildTime string, orchestrator *pluginkit.EvaluationOrchestrator) *cobra.Command
NewPluginCommands creates a new cobra command for the plugin with version and orchestrator support.
func ReadConfig ¶
func ReadConfig()
ReadConfig reads the configuration file specified in the config flag.
Types ¶
type CatalogData ¶ added in v1.12.0
type CatalogData struct {
layer2.Catalog
ServiceName string
Requirements []Req
ApplicabilityCategories []string
StrippedName string
}
CatalogData extends layer2.Catalog with additional fields for plugin generation.
type PluginError ¶ added in v1.11.0
PluginError retains an error object and the name of the pack that generated it.
type PluginErrors ¶ added in v1.11.0
type PluginErrors struct {
Errors []PluginError
}
PluginErrors holds a list of errors and an Error() method so it adheres to the standard Error interface.
func (*PluginErrors) Error ¶ added in v1.11.0
func (e *PluginErrors) Error() string
type PluginPkg ¶ added in v1.11.0
type PluginPkg struct {
Name string
Path string
ServiceTarget string
Command *exec.Cmd
Result string
Available bool
Requested bool
Successful bool
Error error
}
PluginPkg represents a plugin package with its metadata and execution state.
func GetPlugins ¶ added in v1.12.0
func GetPlugins() []*PluginPkg
GetPlugins returns a combined list of all plugins (requested and available).
func NewPluginPkg ¶ added in v1.11.0
NewPluginPkg creates a new PluginPkg instance for the given plugin and service names.