add argument handler
This commit is contained in:
parent
867c4c9b6e
commit
d05925d232
|
@ -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.
|
||||||
|
|
8
main.go
8
main.go
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue