command

package
v0.0.0-...-bb79c78 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2016 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package command is an interface for defining bot commands.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Commmands keyed by golang/regexp patterns
	// regexp.Match(key, input) is used to match
	Commands = map[string]Command{}
)

Functions

This section is empty.

Types

type Command

type Command interface {
	// Executes the command with args passed in
	Exec(args ...string) ([]byte, error)
	// Usage of the command
	Usage() string
	// Description of the command
	Description() string
	// Name of the command
	String() string
}

Command is the interface for specific named commands executed via plugins or the bot.

func Deregister

func Deregister(ctx *cli.Context) Command

Deregister registers a service

func Echo

func Echo(ctx *cli.Context) Command

Echo returns the same message

func Get

func Get(ctx *cli.Context) Command

Get service returns a service

func Health

func Health(ctx *cli.Context) Command

Health returns the health of a service

func Hello

func Hello(ctx *cli.Context) Command

Hello returns a greeting

func List

func List(ctx *cli.Context) Command

List returns a list of services

func NewCommand

func NewCommand(name, usage, description string, exec func(args ...string) ([]byte, error)) Command

NewCommand helps quickly create a new command

func Ping

func Ping(ctx *cli.Context) Command

Ping returns pong

func Query

func Query(ctx *cli.Context) Command

Query returns a service query

func Register

func Register(ctx *cli.Context) Command

Register registers a service

func ThreeLaws

func ThreeLaws(ctx *cli.Context) Command

Laws of robotics

func Time

func Time(ctx *cli.Context) Command

Time returns the time

Jump to

Keyboard shortcuts

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