func outputResults(projects pvi.Projects, c config) { sort.Sort(projects) // Turn color off if we are printing to a file *c.nocolor = *c.filename != "" || *c.nocolor var output string if strings.EqualFold(*c.format, "TEXT") { output = projects.AsText(*c.nocolor, *c.showpath) } else { output = projects.AsJSON() } if *c.filename != "" { pvi.PrintToFile(output, *c.filename) } else { pvi.PrintToTerminal(output) } }
func validate(projects pvi.Projects, c config) { if projects.Len() == 0 { log.Printf("No project directories found under %s", *c.path) os.Exit(0) } }