pluginapi

package
v2.20.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2019 License: Apache-2.0 Imports: 15 Imported by: 7

Documentation

Index

Constants

View Source
const (
	// DebugFlagName is the name of the boolean flag that will be provided as "--<DebugFlagName>" if "debug" is true.
	DebugFlagName = "debug"
	// ProjectDirFlagName is the name of the string flag that is provided as "--<ProjectDirFlagName> <dir>", where
	// "<dir>" is the
	// path to the project directory.
	ProjectDirFlagName = "project-dir"
	// GodelConfigFlagName is the name of the string flag that is provided as "--<GodelConfigFlagName> <config>", where
	// "<config>" is the path to the configuration file for gödel.
	GodelConfigFlagName = "godel-config"
	// ConfigFlagName is the name of the string flag that is provided as "--<ConfigFlagName> <config>", where "<config>"
	// is the path to the configuration file for the plugin.
	ConfigFlagName = "config"
	// AssetsFlagName is the name of the assets flag that is provided as "--<AssetsFlagName> <assets>", where "<assets>"
	// is a comma-delimited list of the paths to the assets for the plugin.
	AssetsFlagName = "assets"
)
View Source
const (
	CurrentSchemaVersion  = "1"
	PluginInfoCommandName = "_godelPluginInfo"
)

Variables

This section is empty.

Functions

func AddAllFlags

func AddAllFlags(fset *flag.FlagSet) (debug *bool, projectDir *string, godelConfig *string, config *string)

func AddAllFlagsPtrs

func AddAllFlagsPtrs(fset *flag.FlagSet, debug *bool, projectDir *string, godelConfig *string, config *string)

func AddAllPFlags

func AddAllPFlags(fset *pflag.FlagSet) (debug *bool, projectDir *string, godelConfig *string, config *string, assets *[]string)

func AddAllPFlagsPtrs

func AddAllPFlagsPtrs(fset *pflag.FlagSet, debug *bool, projectDir *string, godelConfig *string, config *string, assets *[]string)

func AddAssetsPFlag

func AddAssetsPFlag(fset *pflag.FlagSet) *[]string

func AddAssetsPFlagPtr

func AddAssetsPFlagPtr(fset *pflag.FlagSet, assets *[]string)

func AddConfigFlag

func AddConfigFlag(fset *flag.FlagSet) *string

func AddConfigFlagPtr

func AddConfigFlagPtr(fset *flag.FlagSet, config *string)

func AddConfigPFlag

func AddConfigPFlag(fset *pflag.FlagSet) *string

func AddConfigPFlagPtr

func AddConfigPFlagPtr(fset *pflag.FlagSet, config *string)

func AddDebugFlag

func AddDebugFlag(fset *flag.FlagSet) *bool

func AddDebugFlagPtr

func AddDebugFlagPtr(fset *flag.FlagSet, debug *bool)

func AddDebugPFlag

func AddDebugPFlag(fset *pflag.FlagSet) *bool

func AddDebugPFlagPtr

func AddDebugPFlagPtr(fset *pflag.FlagSet, debug *bool)

func AddGodelConfigFlag

func AddGodelConfigFlag(fset *flag.FlagSet) *string

func AddGodelConfigFlagPtr

func AddGodelConfigFlagPtr(fset *flag.FlagSet, godelConfig *string)

func AddGodelConfigPFlag

func AddGodelConfigPFlag(fset *pflag.FlagSet) *string

func AddGodelConfigPFlagPtr

func AddGodelConfigPFlagPtr(fset *pflag.FlagSet, godelConfig *string)

func AddProjectDirFlag

func AddProjectDirFlag(fset *flag.FlagSet) *string

func AddProjectDirFlagPtr

func AddProjectDirFlagPtr(fset *flag.FlagSet, projectDir *string)

func AddProjectDirPFlag

func AddProjectDirPFlag(fset *pflag.FlagSet) *string

func AddProjectDirPFlagPtr

func AddProjectDirPFlagPtr(fset *pflag.FlagSet, projectDir *string)

func CobraInfoCmd

func CobraInfoCmd(info PluginInfo) *cobra.Command

func CobraUpgradeConfigCmd

func CobraUpgradeConfigCmd(upgradeFn UpgradeConfigFn) *cobra.Command

func InfoCmd

func InfoCmd(osArgs []string, stdout io.Writer, info PluginInfo) bool

Types

type GlobalFlagOptions

type GlobalFlagOptions interface {
	DebugFlag() string
	ProjectDirFlag() string
	GodelConfigFlag() string
	ConfigFlag() string
	// contains filtered or unexported methods
}

GlobalFlagOptions is a JSON-serializable interface that can be translated into a godellauncher.GlobalFlagOptions. See godellauncher.GlobalFlagOptions for documentation.

type GlobalFlagOptionsParam

type GlobalFlagOptionsParam interface {
	// contains filtered or unexported methods
}

func GlobalFlagOptionsParamConfigFlag

func GlobalFlagOptionsParamConfigFlag(configFlag string) GlobalFlagOptionsParam

func GlobalFlagOptionsParamDebugFlag

func GlobalFlagOptionsParamDebugFlag(debugFlag string) GlobalFlagOptionsParam

func GlobalFlagOptionsParamGodelConfigFlag

func GlobalFlagOptionsParamGodelConfigFlag(godelConfigFlag string) GlobalFlagOptionsParam

func GlobalFlagOptionsParamProjectDirFlag

func GlobalFlagOptionsParamProjectDirFlag(projectDirFlag string) GlobalFlagOptionsParam

type PluginInfo

type PluginInfo interface {
	// PluginSchemaVersion returns the schema version for the plugin.
	PluginSchemaVersion() string
	// ID returns the identifier for a plugin and is a string of the form "group:product:version".
	ID() string
	// ConfigFileName returns the name of the configuration file used by the plugin. Empty string means that no
	// configuration file is used.
	ConfigFileName() string
	// Tasks returns the tasks provided by the plugin. Requires the path to the plugin executable and assets as input.
	Tasks(pluginExecPath string, assets []string) []godellauncher.Task
	// contains filtered or unexported methods
}

PluginInfo specifies the information for a plugin and the tasks that it provides.

func InfoFromBytes

func InfoFromBytes(infoBytes []byte) (PluginInfo, error)

func InfoFromPlugin

func InfoFromPlugin(pluginPath string) (PluginInfo, error)

InfoFromPlugin returns the Info for the plugin at the specified path. Does so by invoking the InfoCommand on the plugin and parsing the output.

func MustNewPluginInfo

func MustNewPluginInfo(group, product, version string, params ...PluginInfoParam) PluginInfo

MustNewPluginInfo returns the result of calling NewInfo with the provided parameters. Panics if the call to NewPluginInfo returns an error, so this function should only be used when the inputs are static and known to be valid.

func NewPluginInfo

func NewPluginInfo(group, product, version string, params ...PluginInfoParam) (PluginInfo, error)

NewPluginInfo creates a new PluginInfo for the plugin using the provided configuration. Returns an error if the provided configuration is not valid (can occur if multiple tasks have the same name or if a task is not valid).

type PluginInfoParam

type PluginInfoParam interface {
	// contains filtered or unexported methods
}

func PluginInfoGlobalFlagOptions

func PluginInfoGlobalFlagOptions(params ...GlobalFlagOptionsParam) PluginInfoParam

func PluginInfoTaskInfo

func PluginInfoTaskInfo(name, description string, params ...TaskInfoParam) PluginInfoParam

func PluginInfoUsesConfigFile

func PluginInfoUsesConfigFile() PluginInfoParam

type SchemaVersion

type SchemaVersion struct {
	PluginSchemaVersionVar string `json:"pluginSchemaVersion"`
}

type TaskInfo

type TaskInfo interface {
	Name() string
	Description() string
	Command() []string
	GlobalFlagOptions() GlobalFlagOptions
	VerifyOptions() VerifyOptions
	// contains filtered or unexported methods
}

TaskInfo is a JSON-serializable interface that can be translated into a godellauncher.Task. Refer to that struct for field documentation.

type TaskInfoParam

type TaskInfoParam interface {
	// contains filtered or unexported methods
}

func TaskInfoCommand

func TaskInfoCommand(command ...string) TaskInfoParam

func TaskInfoVerifyOptions

func TaskInfoVerifyOptions(params ...VerifyOptionsParam) TaskInfoParam

type UpgradeConfigFn

type UpgradeConfigFn func(cfg []byte) ([]byte, error)

type VerifyFlag

type VerifyFlag interface {
	Name() string
	Description() string
	Type() godellauncher.FlagType
	// contains filtered or unexported methods
}

VerifyFlag is a JSON-serializable interface that can be translated into a godellauncher.VerifyFlag. Refer to that struct for field documentation.

func NewVerifyFlag

func NewVerifyFlag(name, description string, typ godellauncher.FlagType) VerifyFlag

type VerifyOptions

type VerifyOptions interface {
	VerifyTaskFlags() []VerifyFlag
	Ordering() *int
	ApplyTrueArgs() []string
	ApplyFalseArgs() []string
	// contains filtered or unexported methods
}

VerifyOptions is a JSON-serializable interface that can be translated into a godellauncher.VerifyOptions. Refer to that struct for field documentation.

type VerifyOptionsParam

type VerifyOptionsParam interface {
	// contains filtered or unexported methods
}

func VerifyOptionsApplyFalseArgs

func VerifyOptionsApplyFalseArgs(args ...string) VerifyOptionsParam

func VerifyOptionsApplyTrueArgs

func VerifyOptionsApplyTrueArgs(args ...string) VerifyOptionsParam

func VerifyOptionsOrdering

func VerifyOptionsOrdering(ordering *int) VerifyOptionsParam

func VerifyOptionsTaskFlags

func VerifyOptionsTaskFlags(flags ...VerifyFlag) VerifyOptionsParam

Directories

Path Synopsis
v2

Jump to

Keyboard shortcuts

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