From d05925d2326f0297b31d4442a4be67ec1e1ca301 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Tue, 23 Aug 2022 19:58:19 +0200 Subject: [PATCH] add argument handler --- README.md | 2 ++ main.go | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2c7297a..a47cc9b 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,9 @@ In case of a reverse proxy, edit the API Url, eg: `--api-url https://videos.exam ``` muget play --api-url http://127.0.0.1:4000 +muget play --api-url http://127.0.0.1:4000 1 # select the first video muget download --api-url http://127.0.0.1:4000 --directory . +muget download --api-url http://127.0.0.1:4000 --directory . 1-10 # Download the 10 first videos ``` `--directory` is optional. diff --git a/main.go b/main.go index 42829bf..1db436f 100644 --- a/main.go +++ b/main.go @@ -502,10 +502,12 @@ func runShell(ctx *cli.Context, action string) error { name := ctx.String(flagName) order := ctx.String(flagOrder) files := requestFileList(strings.TrimSuffix(ctx.String(flagApiUrl), "/"), name, order) + input := strings.Trim(ctx.Args().Get(0), " ") - showFiles(files) - - input := promptInput("1") + if input == "" { + showFiles(files) + input = promptInput("1") + } if input == "q" { return nil