-a option (#86)

* add -a option

* name
This commit is contained in:
Alexey Kuznetsov 2016-06-15 18:25:48 +03:00 committed by Matt Joiner
parent b84298351a
commit ad5d5bc350
1 changed files with 6 additions and 2 deletions

View File

@ -20,13 +20,17 @@ var (
func main() { func main() {
log.SetFlags(log.Flags() | log.Lshortfile) log.SetFlags(log.Flags() | log.Lshortfile)
var args struct { var args struct {
AnnonceList []string `name:"a" help:"add annonce server"`
tagflag.StartPos tagflag.StartPos
Root string Root string `help:"Creates a torrent metainfo for the file system rooted at ROOT, and outputs it to stdout."`
} }
tagflag.Parse(&args, tagflag.Description("Creates a torrent metainfo for the file system rooted at ROOT, and outputs it to stdout.")) tagflag.Parse(&args)
mi := metainfo.MetaInfo{ mi := metainfo.MetaInfo{
AnnounceList: builtinAnnounceList, AnnounceList: builtinAnnounceList,
} }
for _, a := range args.AnnonceList {
mi.AnnounceList = append(mi.AnnounceList, []string{a})
}
mi.SetDefaults() mi.SetDefaults()
err := mi.Info.BuildFromFilePath(args.Root) err := mi.Info.BuildFromFilePath(args.Root)
if err != nil { if err != nil {