This commit is contained in:
abs3nt 2023-01-13 23:06:43 -08:00
parent 8249488f25
commit 874712bbb2
9 changed files with 46 additions and 39 deletions

View File

@ -12,6 +12,7 @@ func init() {
var likeCmd = &cobra.Command{ var likeCmd = &cobra.Command{
Use: "like", Use: "like",
Aliases: []string{"l"},
Short: "Likes song", Short: "Likes song",
Long: `Likes song`, Long: `Likes song`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {

21
src/cmd/next.go Normal file
View File

@ -0,0 +1,21 @@
package cmd
import (
"gospt/src/commands"
"github.com/spf13/cobra"
)
func init() {
rootCmd.AddCommand(nextCmd)
}
var nextCmd = &cobra.Command{
Use: "next",
Aliases: []string{"n"},
Short: "Skip to next song",
Long: `Skip to next song`,
Run: func(cmd *cobra.Command, args []string) {
commands.Next(ctx, client)
},
}

View File

@ -12,6 +12,7 @@ func init() {
var playCmd = &cobra.Command{ var playCmd = &cobra.Command{
Use: "play", Use: "play",
Aliases: []string{"p"},
Short: "Plays spotify", Short: "Plays spotify",
Long: `Plays queued song on spotify, uses last used device and activates it if needed`, Long: `Plays queued song on spotify, uses last used device and activates it if needed`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {

View File

@ -12,6 +12,7 @@ func init() {
var previousCmd = &cobra.Command{ var previousCmd = &cobra.Command{
Use: "previous", Use: "previous",
Aliases: []string{"b"},
Short: "goes to previous song", Short: "goes to previous song",
Long: `if song is playing it will start over, if close to begining of song it will go to previous song`, Long: `if song is playing it will start over, if close to begining of song it will go to previous song`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {

View File

@ -12,6 +12,7 @@ func init() {
var radioCmd = &cobra.Command{ var radioCmd = &cobra.Command{
Use: "radio", Use: "radio",
Aliases: []string{"r"},
Short: "Starts radio", Short: "Starts radio",
Long: `Starts radio`, Long: `Starts radio`,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -12,6 +12,7 @@ func init() {
var refillRadioCmd = &cobra.Command{ var refillRadioCmd = &cobra.Command{
Use: "refillradio", Use: "refillradio",
Aliases: []string{"rr"},
Short: "Refills the radio", Short: "Refills the radio",
Long: `Deletes all songs up to your position in the radio and adds that many songs to the end of the radio`, Long: `Deletes all songs up to your position in the radio and adds that many songs to the end of the radio`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {

View File

@ -1,20 +0,0 @@
package cmd
import (
"gospt/src/commands"
"github.com/spf13/cobra"
)
func init() {
rootCmd.AddCommand(skipCmd)
}
var skipCmd = &cobra.Command{
Use: "skip",
Short: "Skip to next song",
Long: `Skip to next song`,
Run: func(cmd *cobra.Command, args []string) {
commands.Skip(ctx, client)
},
}

View File

@ -12,6 +12,7 @@ func init() {
var togglePlayCmd = &cobra.Command{ var togglePlayCmd = &cobra.Command{
Use: "toggleplay", Use: "toggleplay",
Aliases: []string{"t"},
Short: "Toggles the play state of spotify", Short: "Toggles the play state of spotify",
Long: `If you are playing a song it will pause and if a song is paused it will play`, Long: `If you are playing a song it will pause and if a song is paused it will play`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {

View File

@ -499,7 +499,7 @@ func Unlike(ctx *gctx.Context, client *spotify.Client) error {
return nil return nil
} }
func Skip(ctx *gctx.Context, client *spotify.Client) error { func Next(ctx *gctx.Context, client *spotify.Client) error {
err := client.Next(ctx) err := client.Next(ctx)
if err != nil { if err != nil {
return err return err