cmd/torrent: Add file pick flag
This commit is contained in:
parent
c0db7e1c26
commit
e67fe7ddca
|
@ -133,7 +133,17 @@ func addTorrents(client *torrent.Client) error {
|
||||||
t.AddPeers(testPeers)
|
t.AddPeers(testPeers)
|
||||||
go func() {
|
go func() {
|
||||||
<-t.GotInfo()
|
<-t.GotInfo()
|
||||||
|
if len(flags.File) == 0 {
|
||||||
t.DownloadAll()
|
t.DownloadAll()
|
||||||
|
} else {
|
||||||
|
for _, f := range t.Files() {
|
||||||
|
for _, fileArg := range flags.File {
|
||||||
|
if f.DisplayPath() == fileArg {
|
||||||
|
f.Download()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -185,6 +195,7 @@ type DownloadCmd struct {
|
||||||
Ipv6 bool
|
Ipv6 bool
|
||||||
Pex bool
|
Pex bool
|
||||||
|
|
||||||
|
File []string
|
||||||
Torrent []string `arity:"+" help:"torrent file path or magnet uri" arg:"positional"`
|
Torrent []string `arity:"+" help:"torrent file path or magnet uri" arg:"positional"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue