Improved default usage output to use flag.PrintDefaults().
This commit is contained in:
parent
9534e41d81
commit
e7f103ff85
@ -17,15 +17,22 @@ import (
|
||||
|
||||
var raw bool
|
||||
|
||||
var usage = func() {
|
||||
fmt.Fprintf(os.Stderr, "usage: %s [optional flags] filename\n", os.Args[0])
|
||||
flag.PrintDefaults()
|
||||
}
|
||||
|
||||
func init() {
|
||||
flag.BoolVar(&raw, "raw", false, "show raw tag data")
|
||||
|
||||
flag.Usage = usage
|
||||
}
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
if flag.NArg() != 1 {
|
||||
fmt.Printf("usage: %v filename\n", os.Args[0])
|
||||
usage()
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user