Example #1
0
func DisplayPullRequests(c *cli.Context, pulls []*gh.PullRequest, notrunc bool) {
	w := newTabwriter()
	fmt.Fprintf(w, "NUMBER\tLAST UPDATED\tTITLE")
	if c.Bool("lgtm") {
		fmt.Fprintf(w, "\tLGTM")
	}
	fmt.Fprintf(w, "\n")
	for _, p := range pulls {
		if !notrunc {
			p.Title = truncate(p.Title)
		}
		fmt.Fprintf(w, "%d\t%s\t%s", p.Number, HumanDuration(time.Since(p.UpdatedAt)), p.Title)
		if c.Bool("lgtm") {
			lgtm := strconv.Itoa(p.ReviewComments)
			if p.ReviewComments >= 2 {
				lgtm = brush.Green(lgtm).String()
			} else if p.ReviewComments == 0 {
				lgtm = brush.DarkRed(lgtm).String()
			} else {
				lgtm = brush.DarkYellow(lgtm).String()
			}
			fmt.Fprintf(w, "\t%s", lgtm)
		}
		fmt.Fprintf(w, "\n")
	}

	if err := w.Flush(); err != nil {
		fmt.Fprintf(os.Stderr, "%s", err)
	}
}
Example #2
0
File: color.go Project: askb/gordon
func DarkYellow(s string) string {
	if Colorize {
		return brush.DarkYellow(s).String()
	}
	return s
}