Example #1
0
// listReviews lists all extant reviews.
// TODO(ojarjur): Add more flags for filtering the output (e.g. filtering by reviewer or status).
func listReviews(repo repository.Repo, args []string) error {
	listFlagSet.Parse(args)
	var reviews []review.Summary
	if *listAll {
		reviews = review.ListAll(repo)
		if !*listJSONOutput {
			fmt.Printf("Loaded %d reviews:\n", len(reviews))
		}
	} else {
		reviews = review.ListOpen(repo)
		if !*listJSONOutput {
			fmt.Printf("Loaded %d open reviews:\n", len(reviews))
		}
	}
	if *listJSONOutput {
		b, err := json.MarshalIndent(reviews, "", "  ")
		if err != nil {
			return err
		}
		fmt.Println(string(b))
		return nil
	}
	for _, r := range reviews {
		output.PrintSummary(&r)
	}
	return nil
}
Example #2
0
// listReviews lists all extant reviews.
// TODO(ojarjur): Add more flags for filtering the output (e.g. filtering by reviewer or status).
func listReviews(repo repository.Repo, args []string) {
	listFlagSet.Parse(args)
	var reviews []review.Summary
	if *listAll {
		reviews = review.ListAll(repo)
		fmt.Printf("Loaded %d reviews:\n", len(reviews))
	} else {
		reviews = review.ListOpen(repo)
		fmt.Printf("Loaded %d open reviews:\n", len(reviews))
	}
	for _, r := range reviews {
		output.PrintSummary(&r)
	}
}