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) } }