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() {
|
||||
var song_url, output_folder string
|
||||
var output_folder string
|
||||
|
||||
application := app.NewApp()
|
||||
|
||||
@@ -20,13 +20,12 @@ func main() {
|
||||
EnableShellCompletion: true,
|
||||
DefaultCommand: "help",
|
||||
Usage: "Spotify downloader with playlist sync in mind.",
|
||||
Flags: []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Commands: []*cli.Command{
|
||||
&cli.Command{
|
||||
Name: "download",
|
||||
Aliases: []string{"d"},
|
||||
Usage: "download a song/playlist",
|
||||
Destination: &song_url,
|
||||
},
|
||||
Flags: []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "output",
|
||||
Aliases: []string{"o"},
|
||||
@@ -35,9 +34,12 @@ func main() {
|
||||
},
|
||||
},
|
||||
Action: func(ctx context.Context, cmd *cli.Command) error {
|
||||
song_url := cmd.Args().First()
|
||||
err := pkg.Download(application, song_url, output_folder)
|
||||
return err
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
if err := cmd.Run(context.Background(), os.Args); err != nil {
|
||||
log.Fatal(err)
|
||||
|
||||
Reference in New Issue
Block a user