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

Function NewCmdStatus

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

Callers 1

TestNewCmdStatusFunction · 0.70

Calls 3

statusRunFunction · 0.70
ConfigMethod · 0.65
AuthenticationMethod · 0.65

Tested by 1

TestNewCmdStatusFunction · 0.56