26 lines
425 B
Go
Raw Normal View History

2024-02-18 10:46:59 -08:00
package commands
import (
"encoding/json"
"fmt"
"github.com/zmb3/spotify/v2"
)
func (c *Commander) ListDevices() error {
devices, err := c.Client.PlayerDevices(c.Context)
if err != nil {
return err
}
return PrintDevices(devices)
}
func PrintDevices(devices []spotify.PlayerDevice) error {
out, err := json.MarshalIndent(devices, "", " ")
if err != nil {
return err
}
fmt.Println(string(out))
return nil
}