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

Function NewCmdStatus

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

Source from the content-addressed store, hash-verified

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

Callers 1

TestNewCmdStatusFunction · 0.70

Calls 3

statusRunFunction · 0.70
ConfigMethod · 0.65
AuthenticationMethod · 0.65

Tested by 1

TestNewCmdStatusFunction · 0.56