command

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultCommands = []*Command{
	{
		Name:        "open",
		Args:        []string{"<buffer>"},
		Heading:     DefaultGroup,
		Description: "Open and change buffers to a given service",
	},
	{
		Name:        "close",
		Args:        []string{"<buffer>"},
		Heading:     DefaultGroup,
		Description: "Close a buffer and return to the last opened previously",
	},
	{
		Name:        "buffer",
		Args:        []string{"<buffer>"},
		Heading:     DefaultGroup,
		Description: "Change to the named buffer",
	},
	{
		Name:        "link",
		Args:        []string{"<current>", "<buffer>"},
		Heading:     DefaultGroup,
		Description: "Overwrite the current buffer with the named",
	},
	{
		Name:        "quit",
		Args:        []string{},
		Heading:     DefaultGroup,
		Description: "Exits the client",
	},
}

TODO(halfiwt) i18n

Functions

func PrintCtlFile

func PrintCtlFile(cmdlist []*Command, to io.WriteCloser) error

Types

type CmdList

type CmdList []*Command

func (CmdList) Len

func (a CmdList) Len() int

func (CmdList) Less

func (a CmdList) Less(i, j int) bool

func (CmdList) Swap

func (a CmdList) Swap(i, j int)

type ComGroup

type ComGroup int

ComGroup is a logical grouping of commands To add a ComGroup, please do so in a PR

const (
	DefaultGroup ComGroup = iota
	ActionGroup
	MediaGroup
	ServiceGroup
)

type Command

type Command struct {
	Name        string
	Description string
	Heading     ComGroup
	Args        []string
	Alias       []string
	From        string
}

Command represents an available command to a service

func ParseCmd added in v0.0.6

func ParseCmd(cmd string, cmdlist []*Command) (*Command, error)

So for this, we want to parse out a proper cmd - each arg can have spaces if it's wrapped in \" \"

func ParseCtlFile added in v0.0.6

func ParseCtlFile(b []byte) ([]*Command, error)

Parse returns any commands found within the byte array

Jump to

Keyboard shortcuts

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