wizard

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetActiveDevice

func GetActiveDevice(devices []core.Device) *core.Device

GetActiveDevice returns the single active device if there is exactly one.

func IsTerminal

func IsTerminal() bool

IsTerminal returns true if stdout is a terminal.

func NeedsDevice

func NeedsDevice(deviceFlag string, devices []core.Device) bool

NeedsDevice returns true if a device argument is required but missing.

func NeedsTrack

func NeedsTrack(args []string) bool

NeedsTrack returns true if a track argument is required but missing.

func RunDevicePicker

func RunDevicePicker(devices []core.Device) (*core.Device, error)

RunDevicePicker runs the device picker and returns the selected device.

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

func (m DeviceModel) Init() tea.Cmd

Init initializes the model.

func (DeviceModel) Selected

func (m DeviceModel) Selected() *core.Device

Selected returns the selected device, or nil if none.

func (DeviceModel) Update

func (m DeviceModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages.

func (DeviceModel) View

func (m DeviceModel) View() string

View renders the model.

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

func (m SearchModel) Init() tea.Cmd

Init initializes the model.

func (SearchModel) Selected

func (m SearchModel) Selected() *SearchResult

Selected returns the selected result, or nil if none.

func (SearchModel) Update

func (m SearchModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages.

func (SearchModel) View

func (m SearchModel) View() string

View renders the model.

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
)

Jump to

Keyboard shortcuts

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