go-micro: github.com/micro/go-micro/agent/command Index | Files

package command

import "github.com/micro/go-micro/agent/command"

Package command is an interface for defining bot commands

Index

Package Files

command.go

Variables

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

type Command Uses

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 NewCommand Uses

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

NewCommand helps quickly create a new command

Package command is imported by 2 packages. Updated 2019-05-31. Refresh now. Tools for package owners.