MCPcopy
hub / github.com/cli/cli / NewCmdStatus

Function NewCmdStatus

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

Source from the content-addressed store, hash-verified

39}
40
41func NewCmdStatus(f *cmdutil.Factory, runF func(*StatusOptions) error) *cobra.Command {
42 opts := &StatusOptions{
43 CachedClient: func(c *http.Client, ttl time.Duration) *http.Client {
44 return api.NewCachedHTTPClient(c, ttl)
45 },
46 }
47 opts.HttpClient = f.HttpClient
48 opts.IO = f.IOStreams
49 cmd := &cobra.Command{
50 Use: "status",
51 Short: "Print information about relevant issues, pull requests, and notifications across repositories",
52 Long: heredoc.Doc(`
53 The status command prints information about your work on GitHub across all the repositories you're subscribed to, including:
54
55 - Assigned Issues
56 - Assigned Pull Requests
57 - Review Requests
58 - Mentions
59 - Repository Activity (new issues/pull requests, comments)
60 `),
61 Example: heredoc.Doc(`
62 $ gh status -e cli/cli -e cli/go-gh # Exclude multiple repositories
63 $ gh status -o cli # Limit results to a single organization
64 `),
65 RunE: func(cmd *cobra.Command, args []string) error {
66 cfg, err := f.Config()
67 if err != nil {
68 return err
69 }
70
71 opts.HostConfig = cfg.Authentication()
72
73 if runF != nil {
74 return runF(opts)
75 }
76
77 return statusRun(opts)
78 },
79 }
80
81 cmd.Flags().StringVarP(&opts.Org, "org", "o", "", "Report status within an organization")
82 cmd.Flags().StringSliceVarP(&opts.Exclude, "exclude", "e", []string{}, "Comma separated list of repos to exclude in owner/name format")
83
84 return cmd
85}
86
87type Notification struct {
88 Reason string

Callers 1

TestNewCmdStatusFunction · 0.70

Calls 3

statusRunFunction · 0.70
ConfigMethod · 0.65
AuthenticationMethod · 0.65

Tested by 1

TestNewCmdStatusFunction · 0.56