cmd/report2cve: document command
A flag.Usage comment is added to document usage for this command.
Change-Id: Ib6d97a901457443b93eb3602c2ccd223c17bbfe7
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/355192
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
diff --git a/cmd/report2cve/main.go b/cmd/report2cve/main.go
index 9d5298c..e4c8973 100644
--- a/cmd/report2cve/main.go
+++ b/cmd/report2cve/main.go
@@ -7,6 +7,7 @@
import (
"encoding/json"
"errors"
+ "flag"
"fmt"
"io/ioutil"
"os"
@@ -212,8 +213,14 @@
}
func main() {
- if len(os.Args) != 2 {
- fmt.Fprint(os.Stderr, "usage: report2cve report.yaml")
+ flag.Usage = func() {
+ fmt.Fprintf(flag.CommandLine.Output(), "usage: report2cve GO-YYYY-NNNN.yaml\n")
+ fmt.Fprintf(flag.CommandLine.Output(), " Create a CVE report from a file with the name structure GO-YYYY-NNNN.yaml in the reports/ directory.\n")
+ flag.PrintDefaults()
+ }
+ flag.Parse()
+ if flag.NArg() != 2 {
+ flag.Usage()
os.Exit(1)
}