/
pr.go
62 lines (57 loc) · 2.22 KB
/
pr.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package pr
import (
"github.com/MakeNowJust/heredoc"
cmdCheckout "github.com/andrewhsu/cli/v2/pkg/cmd/pr/checkout"
cmdChecks "github.com/andrewhsu/cli/v2/pkg/cmd/pr/checks"
cmdClose "github.com/andrewhsu/cli/v2/pkg/cmd/pr/close"
cmdComment "github.com/andrewhsu/cli/v2/pkg/cmd/pr/comment"
cmdCreate "github.com/andrewhsu/cli/v2/pkg/cmd/pr/create"
cmdDiff "github.com/andrewhsu/cli/v2/pkg/cmd/pr/diff"
cmdEdit "github.com/andrewhsu/cli/v2/pkg/cmd/pr/edit"
cmdList "github.com/andrewhsu/cli/v2/pkg/cmd/pr/list"
cmdMerge "github.com/andrewhsu/cli/v2/pkg/cmd/pr/merge"
cmdReady "github.com/andrewhsu/cli/v2/pkg/cmd/pr/ready"
cmdReopen "github.com/andrewhsu/cli/v2/pkg/cmd/pr/reopen"
cmdReview "github.com/andrewhsu/cli/v2/pkg/cmd/pr/review"
cmdStatus "github.com/andrewhsu/cli/v2/pkg/cmd/pr/status"
cmdView "github.com/andrewhsu/cli/v2/pkg/cmd/pr/view"
"github.com/andrewhsu/cli/v2/pkg/cmdutil"
"github.com/spf13/cobra"
)
func NewCmdPR(f *cmdutil.Factory) *cobra.Command {
cmd := &cobra.Command{
Use: "pr <command>",
Short: "Manage pull requests",
Long: "Work with GitHub pull requests",
Example: heredoc.Doc(`
$ gh pr checkout 353
$ gh pr create --fill
$ gh pr view --web
`),
Annotations: map[string]string{
"IsCore": "true",
"help:arguments": heredoc.Doc(`
A pull request can be supplied as argument in any of the following formats:
- by number, e.g. "123";
- by URL, e.g. "https://github.com/OWNER/REPO/pull/123"; or
- by the name of its head branch, e.g. "patch-1" or "OWNER:patch-1".
`),
},
}
cmdutil.EnableRepoOverride(cmd, f)
cmd.AddCommand(cmdCheckout.NewCmdCheckout(f, nil))
cmd.AddCommand(cmdClose.NewCmdClose(f, nil))
cmd.AddCommand(cmdCreate.NewCmdCreate(f, nil))
cmd.AddCommand(cmdDiff.NewCmdDiff(f, nil))
cmd.AddCommand(cmdList.NewCmdList(f, nil))
cmd.AddCommand(cmdMerge.NewCmdMerge(f, nil))
cmd.AddCommand(cmdReady.NewCmdReady(f, nil))
cmd.AddCommand(cmdReopen.NewCmdReopen(f, nil))
cmd.AddCommand(cmdReview.NewCmdReview(f, nil))
cmd.AddCommand(cmdStatus.NewCmdStatus(f, nil))
cmd.AddCommand(cmdView.NewCmdView(f, nil))
cmd.AddCommand(cmdChecks.NewCmdChecks(f, nil))
cmd.AddCommand(cmdComment.NewCmdComment(f, nil))
cmd.AddCommand(cmdEdit.NewCmdEdit(f, nil))
return cmd
}