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>
This commit is contained in:
Julie Qiu 2021-10-05 14:41:20 -05:00
Родитель cd538f209b
Коммит e75710c961
1 изменённых файлов: 9 добавлений и 2 удалений

Просмотреть файл

@ -7,6 +7,7 @@ package main
import (
"encoding/json"
"errors"
"flag"
"fmt"
"io/ioutil"
"os"
@ -212,8 +213,14 @@ func versionToVersion(versions []report.VersionRange) VersionData {
}
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)
}