From: Matt Joiner Date: Fri, 20 Mar 2015 12:18:32 +0000 (+1100) Subject: cmd/torrent: Nicer usage X-Git-Tag: v1.0.0~1256 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=ed8e89a60c827f807bbd9caecd08662a25f4776d;p=btrtrc.git cmd/torrent: Nicer usage --- diff --git a/cmd/torrent/main.go b/cmd/torrent/main.go index 0c927255..411e1d27 100644 --- a/cmd/torrent/main.go +++ b/cmd/torrent/main.go @@ -27,8 +27,16 @@ var ( upload = flag.Bool("upload", true, "upload data to peers") ) +func usage() { + fmt.Fprintf(os.Stderr, "Usage: %s [flags] (magnet URI or .torrent file path)...\n", os.Args[0]) + os.Stderr.WriteString("Download using the BitTorrent network.\n") + + flag.PrintDefaults() +} + func main() { log.SetFlags(log.LstdFlags | log.Lshortfile) + flag.Usage = usage flag.Parse() client, err := torrent.NewClient(&torrent.Config{ DataDir: *downloadDir,