diff --git a/src/components/cli/cli.go b/src/components/cli/cli.go index 7fa0dd4..57ea3d6 100644 --- a/src/components/cli/cli.go +++ b/src/components/cli/cli.go @@ -96,13 +96,19 @@ func Run(c *commands.Commander, s fx.Shutdowner) { }, }, { - Name: "download_cover", - Usage: "Downloads the cover of the current song", - Aliases: []string{"dl"}, - Args: true, - ArgsUsage: "download_cover ", + Name: "download_cover", + Usage: "Downloads the cover of the current song", + Aliases: []string{"dl"}, + Flags: []cli.Flag{ + &cli.PathFlag{ + Name: "path", + Aliases: []string{"p"}, + Usage: "Path to save the cover", + DefaultText: "./cover.png", + }, + }, Action: func(cCtx *cli.Context) error { - return c.DownloadCover(cCtx.Args().First()) + return c.DownloadCover(cCtx.Path("path")) }, }, { @@ -115,6 +121,7 @@ func Run(c *commands.Commander, s fx.Shutdowner) { }, }, } + app.Suggest = true if err := app.Run(os.Args); err != nil { slog.Error("COMMANDER", "run error", err) os.Exit(1) diff --git a/src/components/commands/downloadCover.go b/src/components/commands/downloadCover.go index 0c97976..b14369b 100644 --- a/src/components/commands/downloadCover.go +++ b/src/components/commands/downloadCover.go @@ -6,6 +6,9 @@ import ( ) func (c *Commander) DownloadCover(path string) error { + if path == "" { + path = "cover.png" + } destinationPath := filepath.Clean(path) state, err := c.Client.PlayerState(c.Context) if err != nil {