MCPcopy Index your code
hub / github.com/cli/cli / NewCmdStatus

Function NewCmdStatus

pkg/cmd/pr/status/status.go:42–80  ·  view source on GitHub ↗
(f *cmdutil.Factory, runF func(*StatusOptions) error)

Source from the content-addressed store, hash-verified

40}
41
42func NewCmdStatus(f *cmdutil.Factory, runF func(*StatusOptions) error) *cobra.Command {
43 opts := &StatusOptions{
44 IO: f.IOStreams,
45 HttpClient: f.HttpClient,
46 GitClient: f.GitClient,
47 Config: f.Config,
48 Remotes: f.Remotes,
49 Branch: f.Branch,
50 }
51
52 cmd := &cobra.Command{
53 Use: "status",
54 Short: "Show status of relevant pull requests",
55 Long: heredoc.Docf(`
56 Show status of relevant pull requests.
57
58 The status shows a summary of pull requests that includes information such as
59 pull request number, title, CI checks, reviews, etc.
60
61 To see more details of CI checks, run %[1]sgh pr checks%[1]s.
62 `, "`"),
63 Args: cmdutil.NoArgsQuoteReminder,
64 RunE: func(cmd *cobra.Command, args []string) error {
65 // support `-R, --repo` override
66 opts.BaseRepo = f.BaseRepo
67 opts.HasRepoOverride = cmd.Flags().Changed("repo")
68
69 if runF != nil {
70 return runF(opts)
71 }
72 return statusRun(opts)
73 },
74 }
75
76 cmd.Flags().BoolVarP(&opts.ConflictStatus, "conflict-status", "c", false, "Display the merge conflict status of each pull request")
77 cmdutil.AddJSONFlags(cmd, &opts.Exporter, api.PullRequestFields)
78
79 return cmd
80}
81
82func statusRun(opts *StatusOptions) error {
83 ctx := context.Background()

Callers 1

runCommandWithDetectorFunction · 0.70

Calls 2

AddJSONFlagsFunction · 0.92
statusRunFunction · 0.70

Tested by 1

runCommandWithDetectorFunction · 0.56