2
0
mirror of synced 2025-02-24 14:48:27 +00:00
Matt Joiner fc4fab91f5 Switch to goimports import sorting
Used to use sortimports, but it's old, and goimports seems to have an opinion now.
2018-11-02 23:12:01 +11:00

27 lines
502 B
Go

package main
import (
"fmt"
"os"
"github.com/anacrolix/tagflag"
"github.com/anacrolix/torrent/metainfo"
)
func main() {
tagflag.Parse(nil)
mi, err := metainfo.Load(os.Stdin)
if err != nil {
fmt.Fprintf(os.Stderr, "error reading metainfo from stdin: %s", err)
os.Exit(1)
}
info, err := mi.UnmarshalInfo()
if err != nil {
fmt.Fprintf(os.Stderr, "error unmarshalling info: %s", err)
os.Exit(1)
}
fmt.Fprintf(os.Stdout, "%s\n", mi.Magnet(info.Name, mi.HashInfoBytes()).String())
}