2
0
mirror of synced 2025-02-24 14:48:27 +00:00

cmd/torrent-magnet: Error if arguments are given

Too easy to make this mistake, and then it hangs.
This commit is contained in:
Matt Joiner 2015-04-08 02:15:25 +10:00
parent 6c48d59adb
commit d48b755776

View File

@ -1,6 +1,7 @@
package main
import (
"flag"
"fmt"
"os"
@ -10,6 +11,11 @@ import (
)
func main() {
flag.Parse()
if flag.NArg() != 0 {
fmt.Fprintf(os.Stderr, "%s\n", "torrent-magnet: unexpected positional arguments")
os.Exit(2)
}
mi, err := metainfo.Load(os.Stdin)
if err != nil {
fmt.Fprintf(os.Stderr, "error reading metainfo from stdin: %s", err)