add argument handler

This commit is contained in:
Simon Vieille 2022-08-23 19:58:19 +02:00
parent 867c4c9b6e
commit d05925d232
Signed by: deblan
GPG key ID: 579388D585F70417
2 changed files with 7 additions and 3 deletions

View file

@ -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
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 .
muget download --api-url http://127.0.0.1:4000 --directory . 1-10 # Download the 10 first videos
``` ```
`--directory` is optional. `--directory` is optional.

View file

@ -502,10 +502,12 @@ func runShell(ctx *cli.Context, action string) error {
name := ctx.String(flagName) name := ctx.String(flagName)
order := ctx.String(flagOrder) order := ctx.String(flagOrder)
files := requestFileList(strings.TrimSuffix(ctx.String(flagApiUrl), "/"), name, order) files := requestFileList(strings.TrimSuffix(ctx.String(flagApiUrl), "/"), name, order)
input := strings.Trim(ctx.Args().Get(0), " ")
showFiles(files) if input == "" {
showFiles(files)
input := promptInput("1") input = promptInput("1")
}
if input == "q" { if input == "q" {
return nil return nil