2023-01-14 07:06:43 +00:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
2023-01-17 05:02:23 +00:00
|
|
|
"strconv"
|
|
|
|
|
2023-01-14 07:06:43 +00:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
rootCmd.AddCommand(nextCmd)
|
|
|
|
}
|
|
|
|
|
|
|
|
var nextCmd = &cobra.Command{
|
2023-01-17 05:08:30 +00:00
|
|
|
Use: "next {amount}",
|
2023-01-20 22:19:16 +00:00
|
|
|
Aliases: []string{"n", "skip"},
|
2023-01-17 05:02:23 +00:00
|
|
|
Args: cobra.MatchAll(cobra.RangeArgs(0, 1)),
|
2023-01-17 05:08:30 +00:00
|
|
|
Short: "Skip to next song or skip the specified number of tracks",
|
|
|
|
Long: `Skip to next song of skip the specified number of tracks`,
|
2023-01-17 05:02:23 +00:00
|
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
|
|
skipAmt := 1
|
|
|
|
if len(args) >= 1 {
|
|
|
|
var err error
|
|
|
|
skipAmt, err = strconv.Atoi(args[0])
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
2023-04-16 17:58:50 +00:00
|
|
|
return commands.Next(ctx, skipAmt, false)
|
2023-01-14 07:06:43 +00:00
|
|
|
},
|
|
|
|
}
|