Documentation ¶
Overview ¶
Package commands contains all functionality that is triggered by the user, either through keyboard bindings or the command-line interface. New commands such as 'sort', 'add', etc. must be implemented here.
Index ¶
- Variables
- func Keys() []string
- func TestCommand(data *TestData)
- func TestVerb(t *testing.T, verb string, tests []Test)
- type Add
- type Bind
- type Clear
- type Command
- func New(verb string, a api.API) Command
- func NewAdd(api api.API) Command
- func NewBind(api api.API) Command
- func NewClear(api api.API) Command
- func NewCursor(api api.API) Command
- func NewCut(api api.API) Command
- func NewInputMode(api api.API) Command
- func NewIsolate(api api.API) Command
- func NewList(api api.API) Command
- func NewNext(api api.API) Command
- func NewPaste(api api.API) Command
- func NewPause(api api.API) Command
- func NewPlay(api api.API) Command
- func NewPrevious(api api.API) Command
- func NewPrint(api api.API) Command
- func NewQuit(api api.API) Command
- func NewRedraw(api api.API) Command
- func NewSeek(api api.API) Command
- func NewSelect(api api.API) Command
- func NewSet(api api.API) Command
- func NewSingle(api api.API) Command
- func NewSort(api api.API) Command
- func NewStop(api api.API) Command
- func NewStyle(api api.API) Command
- func NewUnbind(api api.API) Command
- func NewUpdate(api api.API) Command
- func NewViewport(api api.API) Command
- func NewVolume(api api.API) Command
- func NewYank(api api.API) Command
- type Cursor
- type Cut
- type InputMode
- type Isolate
- type List
- type Next
- type Paste
- type Pause
- type Play
- type Previous
- type Print
- type Quit
- type Redraw
- type Seek
- type Select
- type Set
- type Single
- type Sort
- type Stop
- type Style
- type Test
- type TestData
- type Unbind
- type Update
- type Viewport
- type Volume
- type Yank
Constants ¶
This section is empty.
Variables ¶
var Verbs = map[string]func(api.API) Command{ "add": NewAdd, "bind": NewBind, "copy": NewYank, "cursor": NewCursor, "cut": NewCut, "inputmode": NewInputMode, "isolate": NewIsolate, "list": NewList, "next": NewNext, "paste": NewPaste, "pause": NewPause, "play": NewPlay, "previous": NewPrevious, "prev": NewPrevious, "print": NewPrint, "q": NewQuit, "quit": NewQuit, "redraw": NewRedraw, "seek": NewSeek, "select": NewSelect, "se": NewSet, "set": NewSet, "single": NewSingle, "sort": NewSort, "stop": NewStop, "style": NewStyle, "unbind": NewUnbind, "update": NewUpdate, "clear": NewClear, "viewport": NewViewport, "volume": NewVolume, "yank": NewYank, }
Verbs contain mappings from strings to Command constructors. Make sure to add commands here when implementing them.
Functions ¶
func Keys ¶
func Keys() []string
Keys returns a string slice with all verbs that can be invoked to run a command.
func TestCommand ¶
func TestCommand(data *TestData)
TestCommand runs a single test a for Command implementation.
Types ¶
type Add ¶
type Add struct {
// contains filtered or unexported fields
}
Add adds songs to MPD's queue.
func (*Add) ParseTags ¶
ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.
func (*Add) TabComplete ¶
func (c *Add) TabComplete() []string
TabComplete implements Command.TabComplete.
type Bind ¶
type Bind struct {
// contains filtered or unexported fields
}
Bind maps a key sequence to the execution of a command.
func (*Bind) ParseTags ¶
ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.
func (*Bind) TabComplete ¶
func (c *Bind) TabComplete() []string
TabComplete implements Command.TabComplete.
type Clear ¶
type Clear struct {
// contains filtered or unexported fields
}
Clears the queue queue
func (*Clear) ParseTags ¶
ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.
func (*Clear) TabComplete ¶
func (c *Clear) TabComplete() []string
TabComplete implements Command.TabComplete.
type Command ¶
type Command interface { // Execute parses the next input token. // FIXME: Execute is deprecated Execute(class int, s string) error // Exec executes the AST generated by the command. Exec() error // SetScanner assigns a scanner to the command. // FIXME: move to constructor? SetScanner(*lexer.Scanner) // Parse and make an abstract syntax tree. This function MUST NOT have any side effects. Parse() error // TabComplete returns a set of tokens that could possibly be used as the next // command parameter. TabComplete() []string // Scanned returns a slice of tokens that have been scanned using Parse(). Scanned() []parser.Token }
Command must be implemented by all commands.
func NewInputMode ¶
func NewPrevious ¶
type Cursor ¶
type Cursor struct {
// contains filtered or unexported fields
}
Cursor moves the cursor in a songlist widget. It can take human-readable parameters such as 'up' and 'down', and it also accepts relative positions if a number is given.
func (*Cursor) ParseTags ¶
ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.
func (*Cursor) TabComplete ¶
func (c *Cursor) TabComplete() []string
TabComplete implements Command.TabComplete.
type Cut ¶
type Cut struct {
// contains filtered or unexported fields
}
Cut removes songs from songlists.
func (*Cut) ParseTags ¶
ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.
func (*Cut) TabComplete ¶
func (c *Cut) TabComplete() []string
TabComplete implements Command.TabComplete.
type InputMode ¶
type InputMode struct {
// contains filtered or unexported fields
}
InputMode changes the Multibar's input mode.
func (*InputMode) SetScanner ¶
Parse implements Command.Parse.
func (*InputMode) TabComplete ¶
func (c *InputMode) TabComplete() []string
TabComplete implements Command.TabComplete.
type Isolate ¶
type Isolate struct {
// contains filtered or unexported fields
}
Isolate searches for songs that have similar tags as the selection.
func (*Isolate) ParseTags ¶
ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.
func (*Isolate) TabComplete ¶
func (c *Isolate) TabComplete() []string
TabComplete implements Command.TabComplete.
type List ¶
type List struct {
// contains filtered or unexported fields
}
List navigates and manipulates songlists.
func (*List) SetScanner ¶
Parse implements Command.Parse.
func (*List) TabComplete ¶
func (c *List) TabComplete() []string
TabComplete implements Command.TabComplete.
type Next ¶
type Next struct {
// contains filtered or unexported fields
}
Next switches to the next song in MPD's queue.
func (*Next) SetScanner ¶
Parse implements Command.Parse.
func (*Next) TabComplete ¶
func (c *Next) TabComplete() []string
TabComplete implements Command.TabComplete.
type Paste ¶
type Paste struct {
// contains filtered or unexported fields
}
Paste inserts songs from the clipboard.
func (*Paste) ParseTags ¶
ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.
func (*Paste) TabComplete ¶
func (c *Paste) TabComplete() []string
TabComplete implements Command.TabComplete.
type Pause ¶
type Pause struct {
// contains filtered or unexported fields
}
Pause toggles MPD play/paused state. If the player is stopped, Pause will attempt to start playback through the 'play' command instead.
func (*Pause) SetScanner ¶
Parse implements Command.Parse.
func (*Pause) TabComplete ¶
func (c *Pause) TabComplete() []string
TabComplete implements Command.TabComplete.
type Play ¶
type Play struct {
// contains filtered or unexported fields
}
Play plays songs in the MPD playlist.
func (*Play) ParseTags ¶
ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.
func (*Play) TabComplete ¶
func (c *Play) TabComplete() []string
TabComplete implements Command.TabComplete.
type Previous ¶
type Previous struct {
// contains filtered or unexported fields
}
Previous switches to the previous song in MPD's queue.
func (*Previous) SetScanner ¶
Parse implements Command.Parse.
func (*Previous) TabComplete ¶
func (c *Previous) TabComplete() []string
TabComplete implements Command.TabComplete.
type Print ¶
type Print struct {
// contains filtered or unexported fields
}
Print displays information about the selected song's tags.
func (*Print) SetScanner ¶
Parse implements Command.Parse.
func (*Print) TabComplete ¶
func (c *Print) TabComplete() []string
TabComplete implements Command.TabComplete.
type Quit ¶
type Quit struct {
// contains filtered or unexported fields
}
Quit exits the program.
func (*Quit) SetScanner ¶
Parse implements Command.Parse.
func (*Quit) TabComplete ¶
func (c *Quit) TabComplete() []string
TabComplete implements Command.TabComplete.
type Redraw ¶
type Redraw struct {
// contains filtered or unexported fields
}
Quit exits the program.
func (*Redraw) SetScanner ¶
Parse implements Command.Parse.
func (*Redraw) TabComplete ¶
func (c *Redraw) TabComplete() []string
TabComplete implements Command.TabComplete.
type Seek ¶
type Seek struct {
// contains filtered or unexported fields
}
Seek seeks forwards or backwards in the currently playing track.
func (*Seek) ParseTags ¶
ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.
func (*Seek) TabComplete ¶
func (c *Seek) TabComplete() []string
TabComplete implements Command.TabComplete.
type Select ¶
type Select struct {
// contains filtered or unexported fields
}
Select manipulates song selection within a songlist.
func (*Select) ParseTags ¶
ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.
func (*Select) TabComplete ¶
func (c *Select) TabComplete() []string
TabComplete implements Command.TabComplete.
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set manipulates a Options table by parsing input tokens from the "set" command.
func (*Set) ParseTags ¶
ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.
func (*Set) TabComplete ¶
func (c *Set) TabComplete() []string
TabComplete implements Command.TabComplete.
type Single ¶
type Single struct {
// contains filtered or unexported fields
}
Single toggles MPD's single mode on and off.
func (*Single) ParseTags ¶
ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.
func (*Single) TabComplete ¶
func (c *Single) TabComplete() []string
TabComplete implements Command.TabComplete.
type Sort ¶
type Sort struct {
// contains filtered or unexported fields
}
Sort sorts songlists.
func (*Sort) ParseTags ¶
ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.
func (*Sort) TabComplete ¶
func (c *Sort) TabComplete() []string
TabComplete implements Command.TabComplete.
type Stop ¶
type Stop struct {
// contains filtered or unexported fields
}
Stop stops song playback in MPD.
func (*Stop) ParseTags ¶
ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.
func (*Stop) TabComplete ¶
func (c *Stop) TabComplete() []string
TabComplete implements Command.TabComplete.
type Style ¶
type Style struct {
// contains filtered or unexported fields
}
Style manipulates the style table, allowing to set colors and attributes for UI elements.
func (*Style) ParseTags ¶
ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.
func (*Style) TabComplete ¶
func (c *Style) TabComplete() []string
TabComplete implements Command.TabComplete.
type Test ¶
type Test struct { // The input data for the command, as seen on the command line. Input string // True if the command should parse and execute properly, false otherwise. Success bool // An initialization function for tests. Init func(data *TestData) // A callback function to call for every test, allowing customization of tests. Callback func(data *TestData) // A slice of tab completion candidates to expect. TabComplete []string }
Test is a structure for test data, and can be used to conveniently test Command instances.
type Unbind ¶
type Unbind struct {
// contains filtered or unexported fields
}
Unbind unmaps a key sequence.
func (*Unbind) ParseTags ¶
ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.
func (*Unbind) TabComplete ¶
func (c *Unbind) TabComplete() []string
TabComplete implements Command.TabComplete.
type Update ¶
type Update struct {
// contains filtered or unexported fields
}
Update updates MPD database.
func (*Update) ParseTags ¶
ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.
func (*Update) TabComplete ¶
func (c *Update) TabComplete() []string
TabComplete implements Command.TabComplete.
type Viewport ¶
type Viewport struct {
// contains filtered or unexported fields
}
Viewport acts on the viewport, such as scrolling the current songlist.
func (*Viewport) ParseTags ¶
ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.
func (*Viewport) TabComplete ¶
func (c *Viewport) TabComplete() []string
TabComplete implements Command.TabComplete.
type Volume ¶
type Volume struct {
// contains filtered or unexported fields
}
Volume adjusts MPD's volume.
func (*Volume) ParseTags ¶
ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.
func (*Volume) TabComplete ¶
func (c *Volume) TabComplete() []string
TabComplete implements Command.TabComplete.
type Yank ¶
type Yank struct {
// contains filtered or unexported fields
}
Yank copies tracks from the songlist into the clipboard.
func (*Yank) ParseTags ¶
ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.
func (*Yank) TabComplete ¶
func (c *Yank) TabComplete() []string
TabComplete implements Command.TabComplete.