cmd/torrent/main.go | 13 ++++++++++++- diff --git a/cmd/torrent/main.go b/cmd/torrent/main.go index fb0b20750e80a673d2e6c58e87c7d85d5dbad759..ebb0cdfd92b3bd7392dd188f54afe5b73929ef0f 100644 --- a/cmd/torrent/main.go +++ b/cmd/torrent/main.go @@ -133,7 +133,17 @@ } t.AddPeers(testPeers) go func() { <-t.GotInfo() - t.DownloadAll() + if len(flags.File) == 0 { + t.DownloadAll() + } else { + for _, f := range t.Files() { + for _, fileArg := range flags.File { + if f.DisplayPath() == fileArg { + f.Download() + } + } + } + } }() } return nil @@ -185,6 +195,7 @@ Ipv4 bool Ipv6 bool Pex bool + File []string Torrent []string `arity:"+" help:"torrent file path or magnet uri" arg:"positional"` }