// Show the reviewers for this pull request func reviewersCmd(c *cli.Context) { if !c.Args().Present() { gordon.Fatalf("usage: reviewers ID") } var ( patch io.Reader number = c.Args()[0] ) if number == "-" { patch = os.Stdin } else { pr, err := m.GetPullRequest(number) if err != nil { gordon.Fatalf("%s", err) } resp, err := http.Get(pr.DiffURL) if err != nil { gordon.Fatalf("%s", err) } patch = resp.Body defer resp.Body.Close() } reviewers, err := gordon.GetReviewersForPR(patch, false) if err != nil { gordon.Fatalf("%s", err) } gordon.DisplayReviewers(c, reviewers) }
// Show the reviewers for this pull request func reviewersCmd(c *cli.Context) { if !c.Args().Present() { fmt.Println("Please enter a pull request number") return } number := c.Args()[0] var patch io.Reader if number == "-" { patch = os.Stdin } else { pr, _, err := m.GetPullRequest(number, false) if err != nil { gordon.WriteError("%s", err) } resp, err := http.Get(pr.DiffURL) if err != nil { gordon.WriteError("%s", err) } patch = resp.Body defer resp.Body.Close() } reviewers, err := gordon.ReviewPatch(patch, m.GetMaintainersDirMap()) if err != nil { gordon.WriteError("%s", err) } gordon.DisplayReviewers(c, reviewers) }