From e67fe7ddcaec18a483cb2419b66e1db54e431311 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Wed, 9 Dec 2020 20:00:42 +1100 Subject: [PATCH] cmd/torrent: Add file pick flag --- cmd/torrent/main.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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"` } -- 2.44.0