示例#1
0
文件: pvi.go 项目: sgoertzen/pvi
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)
	}
}
示例#2
0
文件: pvi.go 项目: sgoertzen/pvi
func validate(projects pvi.Projects, c config) {
	if projects.Len() == 0 {
		log.Printf("No project directories found under %s", *c.path)
		os.Exit(0)
	}
}