MCPcopy Create free account
hub / github.com/cli/cli / NewCmdPR

Function NewCmdPR

pkg/cmd/pr/pr.go:27–80  ·  view source on GitHub ↗
(f *cmdutil.Factory, telemetry ghtelemetry.InvocationRecorder)

Source from the content-addressed store, hash-verified

25)
26
27func NewCmdPR(f *cmdutil.Factory, telemetry ghtelemetry.InvocationRecorder) *cobra.Command {
28 cmd := &cobra.Command{
29 Use: "pr <command>",
30 Short: "Manage pull requests",
31 Long: heredoc.Docf(`
32 Work with GitHub pull requests.
33
34 To wait for a pull request on %[1]sgithub.com%[1]s to be reviewed, merged, or closed, use %[1]sgh event listen%[1]s instead of polling.
35 Changes made before the listener starts are not reported, so read the pull request once it is listening.
36 `, "`"),
37 Example: heredoc.Doc(`
38 $ gh pr checkout 353
39 $ gh pr create --fill
40 $ gh pr view --web
41 `),
42 Annotations: map[string]string{
43 "help:arguments": heredoc.Doc(`
44 A pull request can be supplied as argument in any of the following formats:
45 - by number, e.g. "123";
46 - by URL, e.g. "https://github.com/OWNER/REPO/pull/123"; or
47 - by the name of its head branch, e.g. "patch-1" or "OWNER:patch-1".
48 `),
49 },
50 GroupID: "core",
51 }
52
53 cmdutil.EnableRepoOverride(cmd, f)
54
55 cmdutil.AddGroup(cmd, "General commands",
56 cmdList.NewCmdList(f, nil),
57 cmdCreate.NewCmdCreate(f, telemetry, nil),
58 cmdStatus.NewCmdStatus(f, nil),
59 )
60
61 cmdutil.AddGroup(cmd, "Targeted commands",
62 cmdView.NewCmdView(f, nil),
63 cmdDiff.NewCmdDiff(f, nil),
64 cmdCheckout.NewCmdCheckout(f, nil),
65 cmdChecks.NewCmdChecks(f, nil),
66 cmdReview.NewCmdReview(f, nil),
67 cmdMerge.NewCmdMerge(f, nil),
68 cmdUpdateBranch.NewCmdUpdateBranch(f, nil),
69 cmdReady.NewCmdReady(f, nil),
70 cmdComment.NewCmdComment(f, telemetry, nil),
71 cmdClose.NewCmdClose(f, nil),
72 cmdReopen.NewCmdReopen(f, nil),
73 cmdRevert.NewCmdRevert(f, nil),
74 cmdEdit.NewCmdEdit(f, telemetry, nil),
75 cmdLock.NewCmdLock(f, cmd.Name(), nil),
76 cmdLock.NewCmdUnlock(f, cmd.Name(), nil),
77 )
78
79 return cmd
80}

Callers

nothing calls this directly

Calls 3

EnableRepoOverrideFunction · 0.92
AddGroupFunction · 0.92
NameMethod · 0.65

Tested by

no test coverage detected