cmd/magnet-metainfo: Use tagflag

This commit is contained in:
Matt Joiner 2017-08-27 11:46:06 +10:00
parent 054ff25f7c
commit 6268fa0b54
1 changed files with 7 additions and 3 deletions

View File

@ -2,19 +2,23 @@
package main
import (
"flag"
"log"
"net/http"
"os"
"sync"
_ "github.com/anacrolix/envpprof"
"github.com/anacrolix/tagflag"
"github.com/anacrolix/torrent"
"github.com/anacrolix/torrent/bencode"
)
func main() {
flag.Parse()
args := struct {
tagflag.StartPos
Magnet []string
}{}
tagflag.Parse(&args)
cl, err := torrent.NewClient(nil)
if err != nil {
log.Fatalf("error creating client: %s", err)
@ -26,7 +30,7 @@ func main() {
cl.DHT().WriteStatus(w)
})
wg := sync.WaitGroup{}
for _, arg := range flag.Args() {
for _, arg := range args.Magnet {
t, err := cl.AddMagnet(arg)
if err != nil {
log.Fatalf("error adding magnet to client: %s", err)