mirror of
https://github.com/Superredstone/spotiflac-cli.git
synced 2026-03-07 20:18:07 +01:00
feat: restructure cli arguments
This commit is contained in:
12
main.go
12
main.go
@@ -11,7 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var song_url, output_folder string
|
var output_folder string
|
||||||
|
|
||||||
application := app.NewApp()
|
application := app.NewApp()
|
||||||
|
|
||||||
@@ -20,13 +20,12 @@ func main() {
|
|||||||
EnableShellCompletion: true,
|
EnableShellCompletion: true,
|
||||||
DefaultCommand: "help",
|
DefaultCommand: "help",
|
||||||
Usage: "Spotify downloader with playlist sync in mind.",
|
Usage: "Spotify downloader with playlist sync in mind.",
|
||||||
Flags: []cli.Flag{
|
Commands: []*cli.Command{
|
||||||
&cli.StringFlag{
|
&cli.Command{
|
||||||
Name: "download",
|
Name: "download",
|
||||||
Aliases: []string{"d"},
|
Aliases: []string{"d"},
|
||||||
Usage: "download a song/playlist",
|
Usage: "download a song/playlist",
|
||||||
Destination: &song_url,
|
Flags: []cli.Flag{
|
||||||
},
|
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "output",
|
Name: "output",
|
||||||
Aliases: []string{"o"},
|
Aliases: []string{"o"},
|
||||||
@@ -35,9 +34,12 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
Action: func(ctx context.Context, cmd *cli.Command) error {
|
Action: func(ctx context.Context, cmd *cli.Command) error {
|
||||||
|
song_url := cmd.Args().First()
|
||||||
err := pkg.Download(application, song_url, output_folder)
|
err := pkg.Download(application, song_url, output_folder)
|
||||||
return err
|
return err
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
if err := cmd.Run(context.Background(), os.Args); err != nil {
|
if err := cmd.Run(context.Background(), os.Args); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
|||||||
Reference in New Issue
Block a user