MCPcopy
hub / github.com/cli/cli / NewCmdDiscussion

Function NewCmdDiscussion

pkg/cmd/discussion/discussion.go:15–51  ·  view source on GitHub ↗

NewCmdDiscussion returns the top-level "discussion" command.

(f *cmdutil.Factory)

Source from the content-addressed store, hash-verified

13
14// NewCmdDiscussion returns the top-level "discussion" command.
15func NewCmdDiscussion(f *cmdutil.Factory) *cobra.Command {
16 cmd := &cobra.Command{
17 Use: "discussion <command>",
18 Short: "Work with GitHub Discussions (preview)",
19 Long: heredoc.Doc(`
20 Working with discussions in the GitHub CLI is in preview and subject to change without notice.
21 `),
22 Example: heredoc.Doc(`
23 $ gh discussion list
24 $ gh discussion create --category "General" --title "Hello" --body "Hello World!"
25 $ gh discussion view 123
26 `),
27 Annotations: map[string]string{
28 "help:arguments": heredoc.Doc(`
29 A discussion can be supplied as argument in any of the following formats:
30 - by number, e.g. "123"; or
31 - by URL, e.g. "https://github.com/OWNER/REPO/discussions/123".
32 `),
33 },
34 GroupID: "core",
35 }
36
37 cmdutil.EnableRepoOverride(cmd, f)
38
39 cmdutil.AddGroup(cmd, "General commands",
40 cmdCreate.NewCmdCreate(f, nil),
41 cmdList.NewCmdList(f, nil),
42 )
43
44 cmdutil.AddGroup(cmd, "Targeted commands",
45 cmdComment.NewCmdComment(f, nil),
46 cmdEdit.NewCmdEdit(f, nil),
47 cmdView.NewCmdView(f, nil),
48 )
49
50 return cmd
51}

Callers

nothing calls this directly

Calls 2

EnableRepoOverrideFunction · 0.92
AddGroupFunction · 0.92

Tested by

no test coverage detected