예제 #1
0
파일: main.go 프로젝트: rogaha/gordon
func mainCmd(c *cli.Context) {
	if !c.Args().Present() {
		filter := filters.GetIssueFilter(c)
		issues, err := filter(m.GetIssues("open", c.String("assigned")))
		if err != nil {
			gordon.WriteError("Error getting issues: %s", err)
		}

		fmt.Printf("%c[2K\r", 27)
		gordon.DisplayIssues(c, issues, c.Bool("no-trunc"))
		return
	}

	var (
		number  = c.Args().Get(0)
		comment = c.String("comment")
	)

	if comment != "" {
		addComment(number, comment)
		return
	}

	if c.Bool("vote") {
		addComment(number, "+1")
		fmt.Fprintf(os.Stdout, "Vote added to the issue: %s", number)
		return
	}

	issue, comments, err := m.GetIssue(number, true)
	if err != nil {
		gordon.WriteError("%s", err)
	}
	gordon.DisplayIssue(issue, comments)
}
예제 #2
0
파일: main.go 프로젝트: pombredanne/pulls
//Search for issues. You add some restrictions to the query. such:
// authors, assignee, state, etc. Check the command help for more options.
func searchCmd(c *cli.Context) {
	if c.Args().Present() {
		issues, err := m.GetIssuesFound(buildQuery(c))
		if err != nil {
			gordon.Fatalf("%s", err)
		}
		fmt.Printf("%c[2K\r", 27)
		gordon.DisplayIssues(c, issues, c.Bool("no-trunc"))
	} else {
		fmt.Printf("Please enter a search term\n")
	}

}