in cmd/vulnreport/main.go [37:88]
func main() {
flag.Usage = func() {
fmt.Fprintf(flag.CommandLine.Output(), "usage: vulnreport [cmd] [filename.yaml]\n")
fmt.Fprintf(flag.CommandLine.Output(), " create [githubIssueNumber]: creates a new vulnerability YAML report\n")
fmt.Fprintf(flag.CommandLine.Output(), " lint [filename.yaml]: lints a vulnerability YAML report\n")
fmt.Fprintf(flag.CommandLine.Output(), " newcve [filename.yaml]: creates a CVE report from the provided YAML report\n")
fmt.Fprintf(flag.CommandLine.Output(), " fix [filename.yaml]: fixes and reformats a YAML report\n")
flag.PrintDefaults()
}
flag.Parse()
if flag.NArg() != 2 {
flag.Usage()
os.Exit(1)
}
cmd := flag.Arg(0)
name := flag.Arg(1)
switch cmd {
case "create":
if *githubToken == "" {
flag.Usage()
log.Fatalf("githubToken must be provided")
}
githubID, err := strconv.Atoi(name)
if err != nil {
log.Fatal(err)
}
repoPath := cvelistrepo.URL
if *localRepoPath != "" {
repoPath = *localRepoPath
}
if err := create(context.Background(), githubID, *githubToken, *issueRepo, repoPath); err != nil {
log.Fatal(err)
}
case "lint":
if err := lint(name); err != nil {
log.Fatal(err)
}
case "newcve":
if err := newCVE(name); err != nil {
log.Fatal(err)
}
case "fix":
if err := fix(name); err != nil {
log.Fatal(err)
}
default:
flag.Usage()
log.Fatalf("unsupported command: %q", cmd)
}
}