mpc-extra/cmd/rate-skip.go

32 lines
629 B
Go
Raw Normal View History

2023-10-17 16:56:24 -05:00
/*
Copyright © 2023 Dan Jones
*/
package cmd
import (
"codeberg.org/danjones000/mpc-extra/mpd"
"github.com/spf13/cobra"
)
// rateSkipCmd represents the rate-skip command
var rateSkipCmd = &cobra.Command{
Use: "rate-skip [rating]",
Args: cobra.MinimumNArgs(1),
Short: "Rate the current song, and skip to the next",
RunE: func(cmd *cobra.Command, args []string) error {
root := cmd.Root()
root.SetArgs([]string{"current", "rate", "--", args[0]})
root.TraverseChildren = false
err := root.Execute()
if err != nil {
return err
}
return mpd.Next()
},
}
func init() {
rootCmd.AddCommand(rateSkipCmd)
}