Beispiel #1
0
// This is the top level command for
// working with prs
func mainCmd(c *cli.Context) {
	if !c.Args().Present() {
		var (
			state   = c.String("state")
			showAll = true // default to true so that we get the fast path
		)
		switch {
		case c.Bool("no-merge"), c.Bool("lgtm"), c.Bool("new"), c.Bool("mine"):
			showAll = false
		}
		displayAllPullRequests(c, state, showAll)
		return
	}

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

	if comment != "" {
		addComment(number, comment)
		return
	}
	pr, comments, err := m.GetPullRequest(number, true)
	if err != nil {
		gordon.WriteError("%s", err)
	}
	gordon.DisplayPullRequest(pr, comments)
}
Beispiel #2
0
// This is the top level command for
// working with prs
func mainCmd(c *cli.Context) {
	if !c.Args().Present() {
		displayAllPullRequests(c)
		return
	}

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

	if comment != "" {
		addComment(number, comment)
		return
	}
	pr, err := m.GetPullRequest(number)
	if err != nil {
		gordon.Fatalf("%s", err)
	}
	gordon.DisplayPullRequest(pr)
}