Documentation ¶
Index ¶
- Constants
- func Abort(input string) bool
- func Confirm(input string) bool
- func Scope() (force.Group, error)
- type Chat
- type ChatEvent
- type ChatParser
- type Command
- type Config
- type Dialog
- type Field
- type FieldParser
- type Listener
- type Namespace
- type NewListen
- type NewPostStatusOf
- type Plugin
- type PostStatusOfAction
- type Setup
- type String
- type StringsEnum
Constants ¶
const ( KeySetup = "Setup" KeyConfig = "Config" KeyListen = "Listen" KeyPostStatusOf = "PostStatusOf" )
const Key = Namespace("slack")
Key is a name of the plugin variable
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Chat ¶
type Chat struct { // Command is a command that has matched Command Command // Values is a list of parsed values Values map[string]interface{} // RequestedHelp is set when user has requested help, // in this case Command contains the command the user has requested // help about RequestedHelp bool }
Chat is a result of parsed chat command
type ChatEvent ¶
type ChatEvent struct { Values interface{} // contains filtered or unexported fields }
ChatEvent is event
func (*ChatEvent) AddMetadata ¶
func (r *ChatEvent) AddMetadata(ctx force.ExecutionContext)
AddMetadata adds metadata to the logger and the context, such as commit id and PR number
type ChatParser ¶
type ChatParser struct {
// contains filtered or unexported fields
}
ChatParser parses chat based on the dialog
func NewParser ¶
func NewParser(d Dialog) (*ChatParser, error)
NewParser returns new chat parser based on the dialog help commands are generated programmatically
func (*ChatParser) HelpMessage ¶
func (p *ChatParser) HelpMessage(commandName string) string
HelpMessage generates and returns help message for individual command or generic message if commandName is empty
func (*ChatParser) Parse ¶
func (p *ChatParser) Parse(input string) (*Chat, error)
Parse parses user input into structured chat
func (*ChatParser) SupportedCommands ¶
func (p *ChatParser) SupportedCommands() []string
SupportedCommands returns a list of supported commands
type Command ¶
type Command struct { // Name is a unique command name Name string // Fields are command fields Fields []Field // Help is a help message Help string // Confirm requests confirmation for command Confirm bool }
Command is matched by regular expression
func (Command) CheckAndSetDefaults ¶
CheckAndSetDefaults checks and sets defaults for command
func (Command) ConfirmationMessage ¶
ConfirmationMessage returns confirmation message
func (Command) HelpMessage ¶
HelpMessage returns command help messsage
type Config ¶
type Config struct { // Token is a slack token Token string }
Config is a slack configuration
func (*Config) CheckAndSetDefaults ¶
type Field ¶
type Field struct { // Name is a field name Name string // Required sets whether the field is required Required bool // Help sets the help Help string // Value is a field parser Value FieldParser }
Field is a command field
func (*Field) HelpMessage ¶
type FieldParser ¶
type FieldParser interface { // Parse parses command Parse(words []string) (interface{}, error) // HelpMessage HelpMessage() string // DefaultValue returns default value DefaultValue() interface{} }
FieldParser parses command
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener is chat listener
func (*Listener) Done ¶
func (r *Listener) Done() <-chan struct{}
Done returns channel closed when repository watcher is closed
func (*Listener) MarshalCode ¶
func (r *Listener) MarshalCode(ctx force.ExecutionContext) ([]byte, error)
MarshalCode marshals things to code
type Namespace ¶
type Namespace string
Namespace is a wrapper around string to namespace a variable in the context
type NewPostStatusOf ¶
type NewPostStatusOf struct { }
NewPostStatusOf returns a function that wraps underlying action and tracks the result, posting the result back
func (*NewPostStatusOf) NewInstance ¶
func (n *NewPostStatusOf) NewInstance(group force.Group) (force.Group, interface{})
NewInstance returns a function creating new post status actions
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin is a new plugin
type PostStatusOfAction ¶
type PostStatusOfAction struct {
// contains filtered or unexported fields
}
PostStatusOfAction executes an action and posts its status to slack
func (*PostStatusOfAction) Eval ¶
func (p *PostStatusOfAction) Eval(ctx force.ExecutionContext) (interface{}, error)
func (*PostStatusOfAction) MarshalCode ¶
func (p *PostStatusOfAction) MarshalCode(ctx force.ExecutionContext) ([]byte, error)
MarshalCode marshals the action into code representation
func (*PostStatusOfAction) Type ¶
func (p *PostStatusOfAction) Type() interface{}
type Setup ¶
type Setup struct {
// contains filtered or unexported fields
}
Setup creates new plugin instances
func (*Setup) Eval ¶
func (n *Setup) Eval(ctx force.ExecutionContext) (interface{}, error)
Run sets up git plugin for the process group
func (*Setup) MarshalCode ¶
func (n *Setup) MarshalCode(ctx force.ExecutionContext) ([]byte, error)
MarshalCode marshals plugin code to representation
func (*Setup) NewInstance ¶
NewInstance returns function creating new client bound to the process group and registers plugin variable
type String ¶
type String struct {
Default string
}
func (String) DefaultValue ¶
func (s String) DefaultValue() interface{}
Default returns default value
func (String) HelpMessage ¶
type StringsEnum ¶
StringsEnum enumerates strings
func (StringsEnum) DefaultValue ¶
func (p StringsEnum) DefaultValue() interface{}
DefaultValue returns default value
func (StringsEnum) Parse ¶
func (p StringsEnum) Parse(words []string) (interface{}, error)
Parse parses the command
func (StringsEnum) SupportedValues ¶
func (p StringsEnum) SupportedValues() string
SupportedValues lists supported values