feat(watch): add command to remove a playlist from the watch list

This commit is contained in:
Mathis Maquenne
2025-06-22 17:51:17 -04:00
parent 95c81a2a67
commit 31d8a3b04f
+35
View File
@@ -0,0 +1,35 @@
package cmd
import (
"fmt"
"github.com/mathismqn/godeez/internal/store"
"github.com/spf13/cobra"
)
var watchRemoveCmd = &cobra.Command{
Use: "remove <playlist_id>",
Short: "Remove a playlist from the watch list",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
id := args[0]
ok, err := store.IsWatched(id)
if err != nil {
return err
}
if !ok {
return fmt.Errorf("playlist %s is not being watched", id)
}
if err := store.RemoveWatchedPlaylist(id); err != nil {
return fmt.Errorf("failed to remove playlist %s from watch list: %w", id, err)
}
fmt.Printf("Playlist %s removed from watch list\n", id)
return nil
},
}
func init() {
watchCmd.AddCommand(watchRemoveCmd)
}