31 lines
629 B
Go
31 lines
629 B
Go
/*
|
|
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)
|
|
}
|