Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotImplemented = errors.New("thirdparty: not implemented")
ErrNotImplemented is the error returned if a method is not implemented.
Functions ¶
func Register ¶
func Register(name CommandName, factory Factory)
Register registers a command factory by name.
The command MUST have a name: lower case and one word.
Types ¶
type Command ¶
type Command interface { // Name returns the third-party command name. Name() CommandName // Run invokes the command with optional arguments. An error is // returned if the command fails, nil otherwise. Run(ctx context.Context, args ...string) error }
Command defines the interface that should be implemented by a third-party command.
func GetInstance ¶
func GetInstance(name CommandName, options ...CommandOption) (Command, error)
GetInstance returns an instance of command by name.
type CommandName ¶
type CommandName string
CommandName represents the name of a third-party command.
type CommandOption ¶
type CommandOption func(*CommandOptions)
CommandOption allows specifying various settings configurable by a command.
type CommandOptions ¶
type Factory ¶
type Factory func(options *CommandOptions) (Command, error)
Factory is a function that returns a command interface. An error is returned if the command fails to initialize, nil otherwise.
func GetFactory ¶
func GetFactory(name CommandName) (Factory, error)
GetFactory returns a factory of command by name.
Click to show internal directories.
Click to hide internal directories.