commands

package
v0.0.0-...-40e63e7 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2023 License: MIT Imports: 33 Imported by: 0

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

Constants

View Source
const (
	ClipboardsContext = "clipboards"
	DevicesContext    = "devices"
	GlobalContext     = "global"
	LibraryContext    = "library"
	PlaylistsContext  = "playlists"
	TracklistContext  = "tracklist"
	WindowsContext    = "windows"
)
View Source
const (
	SeedTypeArtist = "artist"
	SeedTypeGenre  = "genre"
	SeedTypeTrack  = "track"
)
View Source
const (
	RepeatOff     = "off"
	RepeatContext = "context"
	RepeatTrack   = "track"
)

https://github.com/zmb3/spotify/v2/issues/159

Variables

View Source
var Verbs = map[string]func(api.API) Command{
	"add":       NewAdd,
	"auth":      NewAuth,
	"bind":      NewBind,
	"columns":   NewColumns,
	"copy":      NewYank,
	"cursor":    NewCursor,
	"cut":       NewCut,
	"device":    NewDevice,
	"inputmode": NewInputMode,
	"isolate":   NewIsolate,
	"like":      NewLike,
	"list":      NewList,
	"next":      NewNext,
	"paste":     NewPaste,
	"pause":     NewPause,
	"play":      NewPlay,
	"previous":  NewPrevious,
	"prev":      NewPrevious,
	"print":     NewPrint,
	"q":         NewQuit,
	"quit":      NewQuit,
	"recommend": NewRecommend,
	"redraw":    NewRedraw,
	"rename":    NewRename,
	"repeat":    NewRepeat,
	"seek":      NewSeek,
	"select":    NewSelect,
	"se":        NewSet,
	"set":       NewSet,
	"show":      NewShow,
	"shuffle":   NewShuffle,
	"sort":      NewSort,
	"stop":      NewStop,
	"style":     NewStyle,
	"unbind":    NewUnbind,
	"viewport":  NewViewport,
	"volume":    NewVolume,
	"w":         NewWrite,
	"write":     NewWrite,
	"yank":      NewYank,
}

Verbs contain mappings from strings to Command constructors. Make sure to add commands here when implementing them.

Functions

func Contexts

func Contexts(a api.API) []string

Return an ordered list of which program contexts active right now. Local contexts take precedence over global contexts.

func ErrMsgDataType

func ErrMsgDataType(actual list.DataType, expected ...list.DataType) error

func Keys

func Keys() []string

Keys returns a string slice with all verbs that can be invoked to run a command.

func RowContext

func RowContext(dataType list.DataType) string

func TestCommand

func TestCommand(data *TestData)

TestCommand runs a single test a for Command implementation.

func TestVerb

func TestVerb(t *testing.T, verb string, tests []Test)

TestVerb runs table tests for Command implementations.

Types

type Add

type Add struct {
	// contains filtered or unexported fields
}

Add plays songs in the MPD playlist.

func (*Add) Exec

func (cmd *Add) Exec() error

Exec implements Command.

func (*Add) Parse

func (cmd *Add) Parse() error

Parse implements Command.

func (*Add) ParseContext

func (c *Add) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Add) ParseTags

func (c *Add) ParseTags(possibleTags []string) ([]string, error)

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 Auth

type Auth struct {
	// contains filtered or unexported fields
}

Auth runs OAuth2 authentication flow against Spotify.

func (*Auth) Exec

func (cmd *Auth) Exec() error

func (*Auth) Parse

func (cmd *Auth) Parse() error

Parse implements Command.

func (*Auth) ParseContext

func (c *Auth) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Auth) ParseTags

func (c *Auth) ParseTags(possibleTags []string) ([]string, error)

ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.

func (*Auth) TabComplete

func (c *Auth) 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) Exec

func (cmd *Bind) Exec() error

Exec implements Command.

func (*Bind) Parse

func (cmd *Bind) Parse() error

Parse implements Command.

func (*Bind) ParseContext

func (c *Bind) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Bind) ParseTags

func (c *Bind) ParseTags(possibleTags []string) ([]string, error)

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 Columns

type Columns struct {
	// contains filtered or unexported fields
}

Columns sets which column headers should be visible for the current list.

func (*Columns) Exec

func (cmd *Columns) Exec() error

Exec implements Command.

func (*Columns) Parse

func (cmd *Columns) Parse() error

Parse implements Command.

func (*Columns) ParseContext

func (c *Columns) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Columns) ParseTags

func (c *Columns) ParseTags(possibleTags []string) ([]string, error)

ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.

func (*Columns) TabComplete

func (c *Columns) TabComplete() []string

TabComplete implements Command.TabComplete.

type Command

type Command interface {
	// 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 New

func New(verb string, a api.API) Command

New returns the Command associated with the given verb.

func NewAdd

func NewAdd(api api.API) Command

NewAdd returns Add.

func NewAuth

func NewAuth(api api.API) Command

func NewBind

func NewBind(api api.API) Command

NewBind returns Bind.

func NewColumns

func NewColumns(api api.API) Command

NewColumns returns Columns.

func NewCursor

func NewCursor(api api.API) Command

NewCursor returns Cursor.

func NewCut

func NewCut(api api.API) Command

NewCut returns Cut.

func NewDevice

func NewDevice(api api.API) Command

NewDevice returns Device.

func NewInputMode

func NewInputMode(api api.API) Command

func NewIsolate

func NewIsolate(api api.API) Command

NewIsolate returns Isolate.

func NewLike

func NewLike(api api.API) Command

NewLike returns Like.

func NewList

func NewList(api api.API) Command

func NewNext

func NewNext(api api.API) Command

func NewPaste

func NewPaste(api api.API) Command

NewPaste returns Paste.

func NewPause

func NewPause(api api.API) Command

func NewPlay

func NewPlay(api api.API) Command

NewPlay returns Play.

func NewPrevious

func NewPrevious(api api.API) Command

func NewPrint

func NewPrint(api api.API) Command

func NewQuit

func NewQuit(api api.API) Command

func NewRecommend

func NewRecommend(api api.API) Command

NewRecommend returns Recommend.

func NewRedraw

func NewRedraw(api api.API) Command

func NewRename

func NewRename(api api.API) Command

NewRename returns Rename.

func NewRepeat

func NewRepeat(api api.API) Command

NewRepeat returns Repeat.

func NewSeek

func NewSeek(api api.API) Command

NewSeek returns Seek.

func NewSelect

func NewSelect(api api.API) Command

NewSelect returns Select.

func NewSet

func NewSet(api api.API) Command

NewSet returns Set.

func NewShow

func NewShow(api api.API) Command

NewShow returns Show.

func NewShuffle

func NewShuffle(api api.API) Command

NewShuffle returns Shuffle.

func NewSort

func NewSort(api api.API) Command

NewSort returns Sort.

func NewStop

func NewStop(api api.API) Command

NewStop returns Stop.

func NewStyle

func NewStyle(api api.API) Command

NewStyle returns Style.

func NewUnbind

func NewUnbind(api api.API) Command

NewUnbind returns Unbind.

func NewViewport

func NewViewport(api api.API) Command

NewViewport returns Viewport.

func NewVolume

func NewVolume(api api.API) Command

NewVolume returns Volume.

func NewWrite

func NewWrite(api api.API) Command

NewWrite returns Write.

func NewYank

func NewYank(api api.API) Command

NewYank returns Yank.

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) Exec

func (cmd *Cursor) Exec() error

Exec implements Command

func (*Cursor) Parse

func (cmd *Cursor) Parse() error

Parse parses cursor movement.

func (*Cursor) ParseContext

func (c *Cursor) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Cursor) ParseTags

func (c *Cursor) ParseTags(possibleTags []string) ([]string, error)

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) Exec

func (cmd *Cut) Exec() error

Exec implements Command.

func (*Cut) Parse

func (cmd *Cut) Parse() error

Parse implements Command.

func (*Cut) ParseContext

func (c *Cut) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Cut) ParseTags

func (c *Cut) ParseTags(possibleTags []string) ([]string, error)

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 Device

type Device struct {
	// contains filtered or unexported fields
}

Device seeks forwards or backwards in the currently playing track.

func (*Device) Exec

func (cmd *Device) Exec() error

Exec implements Command.

func (*Device) Parse

func (cmd *Device) Parse() error

Parse implements Command.

func (*Device) ParseContext

func (c *Device) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Device) ParseTags

func (c *Device) ParseTags(possibleTags []string) ([]string, error)

ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.

func (*Device) TabComplete

func (c *Device) 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) Exec

func (cmd *InputMode) Exec() error

func (*InputMode) Parse

func (cmd *InputMode) Parse() error

func (*InputMode) ParseContext

func (c *InputMode) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*InputMode) ParseTags

func (c *InputMode) ParseTags(possibleTags []string) ([]string, error)

ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.

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) Exec

func (cmd *Isolate) Exec() error

Exec implements Command.

func (*Isolate) Parse

func (cmd *Isolate) Parse() error

Parse implements Command.

func (*Isolate) ParseContext

func (c *Isolate) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Isolate) ParseTags

func (c *Isolate) ParseTags(possibleTags []string) ([]string, error)

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 Like

type Like struct {
	// contains filtered or unexported fields
}

Like plays songs in the MPD playlist.

func (*Like) Exec

func (cmd *Like) Exec() error

Exec implements Command.

func (*Like) Parse

func (cmd *Like) Parse() error

Parse implements Command.

func (*Like) ParseContext

func (c *Like) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Like) ParseTags

func (c *Like) ParseTags(possibleTags []string) ([]string, error)

ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.

func (*Like) TabComplete

func (c *Like) TabComplete() []string

TabComplete implements Command.TabComplete.

type List

type List struct {
	// contains filtered or unexported fields
}

List navigates and manipulates songlists.

func (*List) Duplicate

func (cmd *List) Duplicate() error

func (*List) Exec

func (cmd *List) Exec() error

func (*List) Goto

func (cmd *List) Goto(id string) error

Goto loads an external list and applies default columns and sorting. Local, cached versions are tried first.

func (*List) New

func (cmd *List) New() error

Exec implements Command.

func (*List) Parse

func (cmd *List) Parse() error

func (*List) ParseContext

func (c *List) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*List) ParseTags

func (c *List) ParseTags(possibleTags []string) ([]string, error)

ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.

func (*List) TabComplete

func (c *List) TabComplete() []string

TabComplete implements Command.TabComplete.

type Next

type Next struct {
	// contains filtered or unexported fields
}

Next instructs the player to go to the next song.

func (*Next) Exec

func (cmd *Next) Exec() error

func (*Next) Parse

func (cmd *Next) Parse() error

func (*Next) ParseContext

func (c *Next) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Next) ParseTags

func (c *Next) ParseTags(possibleTags []string) ([]string, error)

ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.

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) Exec

func (cmd *Paste) Exec() error

Exec implements Command.

func (*Paste) Parse

func (cmd *Paste) Parse() error

Parse implements Command.

func (*Paste) ParseContext

func (c *Paste) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Paste) ParseTags

func (c *Paste) ParseTags(possibleTags []string) ([]string, error)

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 play/paused state.

func (*Pause) Exec

func (cmd *Pause) Exec() error

func (*Pause) Parse

func (cmd *Pause) Parse() error

func (*Pause) ParseContext

func (c *Pause) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Pause) ParseTags

func (c *Pause) ParseTags(possibleTags []string) ([]string, error)

ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.

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) Exec

func (cmd *Play) Exec() error

Exec implements Command.

func (*Play) Parse

func (cmd *Play) Parse() error

Parse implements Command.

func (*Play) ParseContext

func (c *Play) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Play) ParseTags

func (c *Play) ParseTags(possibleTags []string) ([]string, error)

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 instructs the player to go to the previous song.

func (*Previous) Exec

func (cmd *Previous) Exec() error

func (*Previous) Parse

func (cmd *Previous) Parse() error

func (*Previous) ParseContext

func (c *Previous) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Previous) ParseTags

func (c *Previous) ParseTags(possibleTags []string) ([]string, error)

ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.

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) Exec

func (cmd *Print) Exec() error

func (*Print) Parse

func (cmd *Print) Parse() error

func (*Print) ParseContext

func (c *Print) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Print) ParseTags

func (c *Print) ParseTags(possibleTags []string) ([]string, error)

ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.

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) Exec

func (cmd *Quit) Exec() error

func (*Quit) Parse

func (cmd *Quit) Parse() error

Parse implements Command.

func (*Quit) ParseContext

func (c *Quit) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Quit) ParseTags

func (c *Quit) ParseTags(possibleTags []string) ([]string, error)

ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.

func (*Quit) TabComplete

func (c *Quit) TabComplete() []string

TabComplete implements Command.TabComplete.

type Recommend

type Recommend struct {
	// contains filtered or unexported fields
}

Recommend gives a list of tracks similar to the ones selected and within certain constraints. Effectively it implements "track radio" from the official client, but with granular control.

func (*Recommend) Exec

func (cmd *Recommend) Exec() error

Exec implements Command.

func (*Recommend) Parse

func (cmd *Recommend) Parse() error

Parse implements Command.

func (*Recommend) ParseContext

func (c *Recommend) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Recommend) ParseTags

func (c *Recommend) ParseTags(possibleTags []string) ([]string, error)

ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.

func (*Recommend) TabComplete

func (c *Recommend) TabComplete() []string

TabComplete implements Command.TabComplete.

type Redraw

type Redraw struct {
	// contains filtered or unexported fields
}

Redraw forcefully redraws the screen.

func (*Redraw) Exec

func (cmd *Redraw) Exec() error

func (*Redraw) Parse

func (cmd *Redraw) Parse() error

func (*Redraw) ParseContext

func (c *Redraw) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Redraw) ParseTags

func (c *Redraw) ParseTags(possibleTags []string) ([]string, error)

ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.

func (*Redraw) TabComplete

func (c *Redraw) TabComplete() []string

TabComplete implements Command.TabComplete.

type Rename

type Rename struct {
	// contains filtered or unexported fields
}

Rename saves a local tracklist to Spotify.

func (*Rename) Exec

func (cmd *Rename) Exec() error

Exec implements Command.

func (*Rename) Parse

func (cmd *Rename) Parse() error

Parse implements Command.

func (*Rename) ParseContext

func (c *Rename) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Rename) ParseTags

func (c *Rename) ParseTags(possibleTags []string) ([]string, error)

ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.

func (*Rename) TabComplete

func (c *Rename) TabComplete() []string

TabComplete implements Command.TabComplete.

type Repeat

type Repeat struct {
	// contains filtered or unexported fields
}

Repeat sets the playback repeat mode.

func (*Repeat) Exec

func (cmd *Repeat) Exec() error

Exec implements Command.

func (*Repeat) Parse

func (cmd *Repeat) Parse() error

Parse implements Command.

func (*Repeat) ParseContext

func (c *Repeat) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Repeat) ParseTags

func (c *Repeat) ParseTags(possibleTags []string) ([]string, error)

ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.

func (*Repeat) TabComplete

func (c *Repeat) 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) Exec

func (cmd *Seek) Exec() error

Exec implements Command.

func (*Seek) Parse

func (cmd *Seek) Parse() error

Parse implements Command.

func (*Seek) ParseContext

func (c *Seek) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Seek) ParseTags

func (c *Seek) ParseTags(possibleTags []string) ([]string, error)

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) Exec

func (cmd *Select) Exec() error

Exec implements Command.

func (*Select) Parse

func (cmd *Select) Parse() error

Parse implements Command.

func (*Select) ParseContext

func (c *Select) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Select) ParseTags

func (c *Select) ParseTags(possibleTags []string) ([]string, error)

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) Exec

func (cmd *Set) Exec() error

Exec implements Command.

func (*Set) Parse

func (cmd *Set) Parse() error

Parse implements Command.

func (*Set) ParseContext

func (c *Set) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Set) ParseSet

func (cmd *Set) ParseSet() error

ParseSet parses a single "key=val" statement.

func (*Set) ParseTags

func (c *Set) ParseTags(possibleTags []string) ([]string, error)

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 Show

type Show struct {
	// contains filtered or unexported fields
}

Show directs which window (main widget) to show.

func (*Show) Exec

func (cmd *Show) Exec() error

Exec implements Command.

func (*Show) Parse

func (cmd *Show) Parse() error

Parse parses the viewport movement command.

func (*Show) ParseContext

func (c *Show) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Show) ParseTags

func (c *Show) ParseTags(possibleTags []string) ([]string, error)

ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.

func (*Show) TabComplete

func (c *Show) TabComplete() []string

TabComplete implements Command.TabComplete.

type Shuffle

type Shuffle struct {
	// contains filtered or unexported fields
}

Shuffle sets the playback shuffle mode.

func (*Shuffle) Exec

func (cmd *Shuffle) Exec() error

Exec implements Command.

func (*Shuffle) Parse

func (cmd *Shuffle) Parse() error

Parse implements Command.

func (*Shuffle) ParseContext

func (c *Shuffle) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Shuffle) ParseTags

func (c *Shuffle) ParseTags(possibleTags []string) ([]string, error)

ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.

func (*Shuffle) TabComplete

func (c *Shuffle) TabComplete() []string

TabComplete implements Command.TabComplete.

type Sort

type Sort struct {
	// contains filtered or unexported fields
}

Sort sorts songlists.

func (*Sort) Exec

func (cmd *Sort) Exec() error

Exec implements Command.

func (*Sort) Parse

func (cmd *Sort) Parse() error

Parse implements Command.

func (*Sort) ParseContext

func (c *Sort) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Sort) ParseTags

func (c *Sort) ParseTags(possibleTags []string) ([]string, error)

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.

func (*Stop) Exec

func (cmd *Stop) Exec() error

Exec implements Command.

func (*Stop) Parse

func (cmd *Stop) Parse() error

Parse implements Command.

func (*Stop) ParseContext

func (c *Stop) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Stop) ParseTags

func (c *Stop) ParseTags(possibleTags []string) ([]string, error)

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) Exec

func (cmd *Style) Exec() error

Exec implements Command.

func (*Style) Parse

func (cmd *Style) Parse() error

Parse implements Command.

func (*Style) ParseContext

func (c *Style) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Style) ParseTags

func (c *Style) ParseTags(possibleTags []string) ([]string, error)

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 TestData

type TestData struct {
	T       *testing.T
	Cmd     Command
	Api     api.API
	MockAPI *api.MockAPI
	Test    Test
}

TestData contains data needed for a single Command table test.

type Unbind

type Unbind struct {
	// contains filtered or unexported fields
}

Unbind unmaps a key sequence.

func (*Unbind) Exec

func (cmd *Unbind) Exec() error

Exec implements Command.

func (*Unbind) Parse

func (cmd *Unbind) Parse() error

Parse implements Command.

func (*Unbind) ParseContext

func (c *Unbind) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Unbind) ParseTags

func (c *Unbind) ParseTags(possibleTags []string) ([]string, error)

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 Viewport

type Viewport struct {
	// contains filtered or unexported fields
}

Viewport acts on the viewport, such as scrolling the current songlist.

func (*Viewport) Exec

func (cmd *Viewport) Exec() error

Exec implements Command.

func (*Viewport) Parse

func (cmd *Viewport) Parse() error

Parse parses the viewport movement command.

func (*Viewport) ParseContext

func (c *Viewport) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Viewport) ParseTags

func (c *Viewport) ParseTags(possibleTags []string) ([]string, error)

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) Exec

func (cmd *Volume) Exec() error

Exec implements Command.

func (*Volume) Parse

func (cmd *Volume) Parse() error

Parse implements Command.

func (*Volume) ParseContext

func (c *Volume) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Volume) ParseTags

func (c *Volume) ParseTags(possibleTags []string) ([]string, error)

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 Write

type Write struct {
	// contains filtered or unexported fields
}

Write saves a local tracklist to Spotify.

func (*Write) Exec

func (cmd *Write) Exec() error

Exec implements Command.

func (*Write) Parse

func (cmd *Write) Parse() error

Parse implements Command.

func (*Write) ParseContext

func (c *Write) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Write) ParseTags

func (c *Write) ParseTags(possibleTags []string) ([]string, error)

ParseTags parses a set of tags until the end of the line, and maintains the tab complete list according to a specified song.

func (*Write) TabComplete

func (c *Write) 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) Exec

func (cmd *Yank) Exec() error

Exec implements Command.

func (*Yank) Parse

func (cmd *Yank) Parse() error

Parse implements Command.

func (*Yank) ParseContext

func (c *Yank) ParseContext() (string, error)

ParseContext parses a single identifier and verifies that it is a program context.

func (*Yank) ParseTags

func (c *Yank) ParseTags(possibleTags []string) ([]string, error)

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.

Jump to

Keyboard shortcuts

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