Documentation
¶
Index ¶
- func DeserializeSettings(bytes []byte, settings *Settings) error
- func RegisterAction(Action ActionOps)
- func SaveSettings(settings Settings) error
- type Action
- type ActionImpl
- func (c *ActionImpl) AcquireValues() bool
- func (c *ActionImpl) Execute(logChannel chan string) bool
- func (c *ActionImpl) GetCommand() string
- func (c *ActionImpl) GetExitCode() int
- func (c *ActionImpl) GetLastMessage() string
- func (c *ActionImpl) GetName() string
- func (c *ActionImpl) GetUsage() string
- func (c ActionImpl) Init() bool
- func (c *ActionImpl) IsInProgress() bool
- func (c ActionImpl) Reset() bool
- func (c *ActionImpl) SetArgumentParser(parser ArgumentParser)
- func (c *ActionImpl) SetExecutor(command Command)
- type ActionOps
- type ActionRegistry
- type ArgumentParser
- type Command
- type Parameter
- type Settings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeserializeSettings ¶
func RegisterAction ¶
func RegisterAction(Action ActionOps)
func SaveSettings ¶
Types ¶
type Action ¶
type Action struct { Parameters []Parameter `yaml:"parameters"` Name string `yaml:"name"` Command string `yaml:"command"` Description string `yaml:"description"` Usage string `yaml:"usage"` }
* Action structure, used for defining action data
type ActionImpl ¶
type ActionImpl struct { Action InProgress bool Success bool Message string Parser ArgumentParser Executor Command }
func (*ActionImpl) AcquireValues ¶
func (c *ActionImpl) AcquireValues() bool
func (*ActionImpl) Execute ¶
func (c *ActionImpl) Execute(logChannel chan string) bool
func (*ActionImpl) GetCommand ¶
func (c *ActionImpl) GetCommand() string
func (*ActionImpl) GetExitCode ¶
func (c *ActionImpl) GetExitCode() int
func (*ActionImpl) GetLastMessage ¶
func (c *ActionImpl) GetLastMessage() string
func (*ActionImpl) GetName ¶
func (c *ActionImpl) GetName() string
func (*ActionImpl) GetUsage ¶
func (c *ActionImpl) GetUsage() string
func (ActionImpl) Init ¶
func (c ActionImpl) Init() bool
func (*ActionImpl) IsInProgress ¶
func (c *ActionImpl) IsInProgress() bool
func (ActionImpl) Reset ¶
func (c ActionImpl) Reset() bool
func (*ActionImpl) SetArgumentParser ¶
func (c *ActionImpl) SetArgumentParser(parser ArgumentParser)
func (*ActionImpl) SetExecutor ¶
func (c *ActionImpl) SetExecutor(command Command)
type ActionOps ¶
type ActionOps interface { /* * Init method * Initialise Action to work */ Init() bool /* * Reset method * Reset Action for next work */ Reset() bool /* * Execute method * Execute Action accordingly to parameters * Return execution start/complete status */ Execute(chan string) bool /* * IsInProgress method * Return execution progress state */ IsInProgress() bool /* * GetCommand method * Return command name */ GetCommand() string /* * GetName method * Return command descriptive name */ GetName() string /* * GetUsage method * Return command usage sample */ GetUsage() string /* * AcquireValues method * Return flag if parameters are satisfied */ AcquireValues() bool /* * GetExitCode method * Return execution exit code (0 - ok) */ GetExitCode() int /* * GetLastMessage method * Return operation message or error message */ GetLastMessage() string /* * SetArgumentParser method * Set Specific Action argument parser */ SetArgumentParser(ArgumentParser) /* * SetArgumentParser method * Set Specific Action argument parser */ SetExecutor(Command) }
* ActionOps interface, defining abstract Action Operations
type ActionRegistry ¶
type ActionRegistry struct {
Actions []ActionOps
}
* ActionRegistry structure, used for collecting plugins
var ActiveActionRegistry ActionRegistry = ActionRegistry{}
func GetActionRegistry ¶
func GetActionRegistry() *ActionRegistry
func (*ActionRegistry) Add ¶
func (r *ActionRegistry) Add(a ActionOps)
* ActionRegistry Add method, add a single action to registry
func (*ActionRegistry) AddMany ¶
func (r *ActionRegistry) AddMany(a []ActionOps)
* ActionRegistry AddMany method, add a multiple actions to registry
func (*ActionRegistry) ElementAt ¶
func (r *ActionRegistry) ElementAt(index int) ActionOps
* ActionRegistry ElementAt method, return one action in registry at index or nil
func (*ActionRegistry) GetActions ¶
func (r *ActionRegistry) GetActions() []ActionOps
* ActionRegistry GetActions method, return all actions in registry
func (*ActionRegistry) Size ¶
func (r *ActionRegistry) Size() int
* ActionRegistry Size method, return number of actions in registry
type ArgumentParser ¶
type ArgumentParser interface { Validate() bool Parse() []interface{} }
type Command ¶
type Command interface {
Execute(*ActionImpl, []interface{}, chan string) bool
}
Click to show internal directories.
Click to hide internal directories.