gospt/src/cmd/next.go

33 lines
559 B
Go
Raw Normal View History

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
"gospt/src/commands"
"github.com/spf13/cobra"
)
func init() {
rootCmd.AddCommand(nextCmd)
}
var nextCmd = &cobra.Command{
Use: "next",
Aliases: []string{"n"},
2023-01-17 05:02:23 +00:00
Args: cobra.MatchAll(cobra.RangeArgs(0, 1)),
2023-01-14 07:06:43 +00:00
Short: "Skip to next song",
Long: `Skip to next song`,
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
}
}
return commands.Next(ctx, client, skipAmt)
2023-01-14 07:06:43 +00:00
},
}