func FilterIssues(c *cli.Context, issues []*gh.Issue) ([]*gh.Issue, error) { var ( yesterday = time.Now().Add(-24 * time.Hour) out = []*gh.Issue{} client = gh.NewClient() org, name, err = gordon.GetRemoteUrl(c.String("remote")) ) if err != nil { return nil, err } t, err := gordon.NewMaintainerManager(client, org, name) if err != nil { return nil, err } for _, issue := range issues { fmt.Printf(".") if c.Bool("new") && !issue.CreatedAt.After(yesterday) { continue } if milestone := c.String("milestone"); milestone != "" && issue.Milestone.Title != milestone { continue } if numVotes := c.Int("votes"); numVotes > 0 { comments, err := t.GetComments(strconv.Itoa(issue.Number)) if err != nil { return nil, err } issue.Comments = 0 for _, comment := range comments { if strings.Contains(comment.Body, "+1") { issue.Comments += 1 } } if issue.Comments < numVotes { continue } } if c.Bool("proposals") && !strings.HasPrefix(issue.Title, "Proposal") { continue } out = append(out, issue) } return out, nil }
func before(c *cli.Context) error { client := gh.NewClient() org, name, err := gordon.GetRemoteUrl(c.String("remote")) if err != nil { return fmt.Errorf("The current directory is not a valid git repository (%s).\n", err) } t, err := gordon.NewMaintainerManager(client, org, name) if err != nil { return err } m = t return nil }
func before(c *cli.Context) error { client := gh.NewClient() // set up the git remote to be used org, name, err := gordon.GetRemoteUrl(c.String("remote")) if err != nil { return fmt.Errorf("The current directory is not a valid git repository (%s).\n", err) } t, err := gordon.NewMaintainerManager(client, org, name) if err != nil { return err } m = t // Set verbosity gordon.VerboseOutput = c.Bool("verbose") return nil }