tools: Add summary mode to reviewers command
It's not always necessary to see every PR link, sometimes it's helpful to just see the
overall stats
@@ -45,6 +45,7 @@ func newReviewersCommand() *cobra.Command {
var (
daysBack int
numReviewers int
+ summaryMode bool
)
ignoreReviewers := multiStringArg{}
@@ -93,12 +94,14 @@ func newReviewersCommand() *cobra.Command {
sort.Slice(prs, func(i, j int) bool {
return prs[i].ReviewCount > prs[j].ReviewCount
})
+ if summaryMode != true {
for _, prWithCount := range prs {
pr := prWithCount.PR
fmt.Printf("\t%3d: %s [%s] %q\n", prWithCount.ReviewCount,
*pr.HTMLURL, *pr.User.Login, *pr.Title)
}
}
+ }
return nil
},
@@ -107,6 +110,7 @@ func newReviewersCommand() *cobra.Command {
cmd.Flags().IntVar(&daysBack, "days-back", 31, "how many days back to query, defaults to 31")
cmd.Flags().IntVar(&numReviewers, "num", 10, "number of reviewers to show, 0 is all")
cmd.Flags().Var(&ignoreReviewers, "ignore", "ignore a reviewer, can be repeated")
+ cmd.Flags().BoolVar(&summaryMode, "summary", false, "show only summary (reviewer identity and totals)")
return cmd
}
