commanders

package
v0.0.0-...-b94e071 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2020 License: GPL-3.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommanderList []Commander

CommanderList contains a list of available commands

View Source
var CommandsData struct {
	Commands []struct {
		Name     string
		Hostname string
		Command  string
		Regex    string
		Example  string
	}
}

CommandsData holds the commands in the json format read from commands.json

Functions

func SyncCommands

func SyncCommands(commandsPath string) error

SyncCommands with the database

Types

type Commander

type Commander interface {
	GetName() string
	GetCatagory() string
	MatchCommand(string) bool
	Execute(payload.Handler) (map[string]interface{}, error)
}

Commander interface

func GetCommander

func GetCommander(text string) (Commander, error)

GetCommander returns an appropriate Commander by matching the text with existing templates

type DialogFlowCommand

type DialogFlowCommand struct {
	Name         string
	Catagory     string
	OutputFormat string
	Scope        int64
	RegexPattern *regexp.Regexp
}

DialogFlowCommand structure

func (DialogFlowCommand) Execute

func (uc DialogFlowCommand) Execute(payload payload.Handler) (map[string]interface{}, error)

Execute the given command

func (DialogFlowCommand) GetCatagory

func (uc DialogFlowCommand) GetCatagory() string

GetCatagory of the given command

func (DialogFlowCommand) GetName

func (uc DialogFlowCommand) GetName() string

GetName of the given command

func (DialogFlowCommand) GetScope

func (uc DialogFlowCommand) GetScope() int64

GetScope required to execute this command

func (DialogFlowCommand) MatchCommand

func (uc DialogFlowCommand) MatchCommand(text string) bool

MatchCommand based of regex

type LocalBashCommand

type LocalBashCommand struct {
	Command      string
	Name         string
	Catagory     string
	OutputFormat string
	Scope        int64
	RegexPattern *regexp.Regexp
}

LocalBashCommand structure

func (LocalBashCommand) Execute

func (bc LocalBashCommand) Execute(payloadHandler payload.Handler) (map[string]interface{}, error)

Execute given command

func (LocalBashCommand) GetCatagory

func (bc LocalBashCommand) GetCatagory() string

GetCatagory that was executed

func (LocalBashCommand) GetName

func (bc LocalBashCommand) GetName() string

GetName the name of the command that was execute

func (LocalBashCommand) GetScope

func (bc LocalBashCommand) GetScope() int64

GetScope that is required to run this command

func (LocalBashCommand) MatchCommand

func (bc LocalBashCommand) MatchCommand(text string) bool

MatchCommand from the list of commands

Jump to

Keyboard shortcuts

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