From: Matt Joiner Date: Wed, 9 Dec 2020 09:00:42 +0000 (+1100) Subject: cmd/torrent: Add file pick flag X-Git-Tag: v1.19.0~8 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=e67fe7ddcaec18a483cb2419b66e1db54e431311;p=btrtrc.git cmd/torrent: Add file pick flag --- diff --git a/cmd/torrent/main.go b/cmd/torrent/main.go index fb0b2075..ebb0cdfd 100644 --- a/cmd/torrent/main.go +++ b/cmd/torrent/main.go @@ -133,7 +133,17 @@ func addTorrents(client *torrent.Client) error { 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 @@ type DownloadCmd struct { Ipv6 bool Pex bool + File []string Torrent []string `arity:"+" help:"torrent file path or magnet uri" arg:"positional"` }