File: issue.go

package info (click to toggle)
gh 2.46.0-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 15,548 kB
  • sloc: sh: 227; makefile: 117
file content (67 lines) | stat: -rw-r--r-- 2,104 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package issue

import (
	"github.com/MakeNowJust/heredoc"
	cmdClose "github.com/cli/cli/v2/pkg/cmd/issue/close"
	cmdComment "github.com/cli/cli/v2/pkg/cmd/issue/comment"
	cmdCreate "github.com/cli/cli/v2/pkg/cmd/issue/create"
	cmdDelete "github.com/cli/cli/v2/pkg/cmd/issue/delete"
	cmdDevelop "github.com/cli/cli/v2/pkg/cmd/issue/develop"
	cmdEdit "github.com/cli/cli/v2/pkg/cmd/issue/edit"
	cmdList "github.com/cli/cli/v2/pkg/cmd/issue/list"
	cmdLock "github.com/cli/cli/v2/pkg/cmd/issue/lock"
	cmdPin "github.com/cli/cli/v2/pkg/cmd/issue/pin"
	cmdReopen "github.com/cli/cli/v2/pkg/cmd/issue/reopen"
	cmdStatus "github.com/cli/cli/v2/pkg/cmd/issue/status"
	cmdTransfer "github.com/cli/cli/v2/pkg/cmd/issue/transfer"
	cmdUnpin "github.com/cli/cli/v2/pkg/cmd/issue/unpin"
	cmdView "github.com/cli/cli/v2/pkg/cmd/issue/view"
	"github.com/cli/cli/v2/pkg/cmdutil"
	"github.com/spf13/cobra"
)

func NewCmdIssue(f *cmdutil.Factory) *cobra.Command {
	cmd := &cobra.Command{
		Use:   "issue <command>",
		Short: "Manage issues",
		Long:  `Work with GitHub issues.`,
		Example: heredoc.Doc(`
			$ gh issue list
			$ gh issue create --label bug
			$ gh issue view 123 --web
		`),
		Annotations: map[string]string{
			"help:arguments": heredoc.Doc(`
				An issue can be supplied as argument in any of the following formats:
				- by number, e.g. "123"; or
				- by URL, e.g. "https://github.com/OWNER/REPO/issues/123".
			`),
		},
		GroupID: "core",
	}

	cmdutil.EnableRepoOverride(cmd, f)

	cmdutil.AddGroup(cmd, "General commands",
		cmdList.NewCmdList(f, nil),
		cmdCreate.NewCmdCreate(f, nil),
		cmdStatus.NewCmdStatus(f, nil),
	)

	cmdutil.AddGroup(cmd, "Targeted commands",
		cmdView.NewCmdView(f, nil),
		cmdComment.NewCmdComment(f, nil),
		cmdClose.NewCmdClose(f, nil),
		cmdReopen.NewCmdReopen(f, nil),
		cmdEdit.NewCmdEdit(f, nil),
		cmdDevelop.NewCmdDevelop(f, nil),
		cmdLock.NewCmdLock(f, cmd.Name(), nil),
		cmdLock.NewCmdUnlock(f, cmd.Name(), nil),
		cmdPin.NewCmdPin(f, nil),
		cmdUnpin.NewCmdUnpin(f, nil),
		cmdTransfer.NewCmdTransfer(f, nil),
		cmdDelete.NewCmdDelete(f, nil),
	)

	return cmd
}