From 1747097e7ac3da17c5483608c578a9f6c7e53fd0 Mon Sep 17 00:00:00 2001 From: abs3nt Date: Sun, 18 Feb 2024 11:14:21 -0800 Subject: [PATCH] setdevice --- src/components/cli/cli.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/cli/cli.go b/src/components/cli/cli.go index fb5d0e0..6828ff4 100644 --- a/src/components/cli/cli.go +++ b/src/components/cli/cli.go @@ -1,6 +1,7 @@ package cli import ( + "fmt" "log/slog" "os" "strconv" @@ -213,9 +214,14 @@ func Run(c *commands.Commander, s fx.Shutdowner) { }, }, { - Name: "setdevice", - Usage: "Set the active device", + Name: "setdevice", + Usage: "Set the active device", + Args: true, + ArgsUsage: "", Action: func(cCtx *cli.Context) error { + if cCtx.NArg() == 0 { + return fmt.Errorf("no device id provided") + } return c.SetDevice(spotify.ID(cCtx.Args().First())) }, },