Documentation
¶
Index ¶
- func GetActiveDevice(devices []core.Device) *core.Device
- func IsTerminal() bool
- func NeedsDevice(deviceFlag string, devices []core.Device) bool
- func NeedsTrack(args []string) bool
- func RunDevicePicker(devices []core.Device) (*core.Device, error)
- type DeviceModel
- type Interactive
- func (i *Interactive) CanInteract() bool
- func (i *Interactive) PromptDevice() (*core.Device, error)
- func (i *Interactive) PromptSearch() (*SearchResult, error)
- func (i *Interactive) SetDevices(devices []core.Device)
- func (i *Interactive) SetEnabled(enabled bool)
- func (i *Interactive) SetSearchFunc(fn SearchFunc)
- type SearchFunc
- type SearchModel
- type SearchResult
- type SearchType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetActiveDevice ¶
GetActiveDevice returns the single active device if there is exactly one.
func NeedsDevice ¶
NeedsDevice returns true if a device argument is required but missing.
func NeedsTrack ¶
NeedsTrack returns true if a track argument is required but missing.
Types ¶
type DeviceModel ¶
type DeviceModel struct {
// contains filtered or unexported fields
}
DeviceModel is the bubbletea model for the device picker.
func NewDeviceModel ¶
func NewDeviceModel(devices []core.Device) DeviceModel
NewDeviceModel creates a new device picker model.
func (DeviceModel) Selected ¶
func (m DeviceModel) Selected() *core.Device
Selected returns the selected device, or nil if none.
type Interactive ¶
type Interactive struct {
// contains filtered or unexported fields
}
Interactive provides interactive fallback functionality.
func NewInteractive ¶
func NewInteractive() *Interactive
NewInteractive creates a new interactive handler.
func (*Interactive) CanInteract ¶
func (i *Interactive) CanInteract() bool
CanInteract returns true if interactive mode is available.
func (*Interactive) PromptDevice ¶
func (i *Interactive) PromptDevice() (*core.Device, error)
PromptDevice launches the device picker if interactive mode is available. Returns the selected device, or nil if cancelled or not interactive.
func (*Interactive) PromptSearch ¶
func (i *Interactive) PromptSearch() (*SearchResult, error)
PromptSearch launches the search wizard if interactive mode is available. Returns the selected result, or nil if cancelled or not interactive.
func (*Interactive) SetDevices ¶
func (i *Interactive) SetDevices(devices []core.Device)
SetDevices sets the available devices for the device picker.
func (*Interactive) SetEnabled ¶
func (i *Interactive) SetEnabled(enabled bool)
SetEnabled enables or disables interactive mode.
func (*Interactive) SetSearchFunc ¶
func (i *Interactive) SetSearchFunc(fn SearchFunc)
SetSearchFunc sets the search function for the search wizard.
type SearchFunc ¶
type SearchFunc func(query string, searchType SearchType) ([]SearchResult, error)
SearchFunc is a function that performs a search.
type SearchModel ¶
type SearchModel struct {
// contains filtered or unexported fields
}
SearchModel is the bubbletea model for the search wizard.
func NewSearchModel ¶
func NewSearchModel(searchFunc SearchFunc) SearchModel
NewSearchModel creates a new search wizard model.
func (SearchModel) Selected ¶
func (m SearchModel) Selected() *SearchResult
Selected returns the selected result, or nil if none.
type SearchResult ¶
type SearchResult struct {
ID string
URI string
Title string
Subtitle string
Type SearchType
}
SearchResult represents a search result item.
func RunSearch ¶
func RunSearch(searchFunc SearchFunc) (*SearchResult, error)
RunSearch runs the search wizard and returns the selected result.
type SearchType ¶
type SearchType int
SearchType represents the type of search to perform.
const ( SearchAll SearchType = iota SearchTracks SearchAlbums SearchArtists SearchPlaylists )