cmd/torrent-magnet: Error if arguments are given
Too easy to make this mistake, and then it hangs.
This commit is contained in:
parent
6c48d59adb
commit
d48b755776
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user