github.com/ungtb10d/cli/v2@v2.0.0-20221110210412-98537dd9d6a1/pkg/cmd/issue/issue.go (about)

     1  package issue
     2  
     3  import (
     4  	"github.com/MakeNowJust/heredoc"
     5  	cmdClose "github.com/ungtb10d/cli/v2/pkg/cmd/issue/close"
     6  	cmdComment "github.com/ungtb10d/cli/v2/pkg/cmd/issue/comment"
     7  	cmdCreate "github.com/ungtb10d/cli/v2/pkg/cmd/issue/create"
     8  	cmdDelete "github.com/ungtb10d/cli/v2/pkg/cmd/issue/delete"
     9  	cmdDevelop "github.com/ungtb10d/cli/v2/pkg/cmd/issue/develop"
    10  	cmdEdit "github.com/ungtb10d/cli/v2/pkg/cmd/issue/edit"
    11  	cmdList "github.com/ungtb10d/cli/v2/pkg/cmd/issue/list"
    12  	cmdPin "github.com/ungtb10d/cli/v2/pkg/cmd/issue/pin"
    13  	cmdReopen "github.com/ungtb10d/cli/v2/pkg/cmd/issue/reopen"
    14  	cmdStatus "github.com/ungtb10d/cli/v2/pkg/cmd/issue/status"
    15  	cmdTransfer "github.com/ungtb10d/cli/v2/pkg/cmd/issue/transfer"
    16  	cmdUnpin "github.com/ungtb10d/cli/v2/pkg/cmd/issue/unpin"
    17  	cmdView "github.com/ungtb10d/cli/v2/pkg/cmd/issue/view"
    18  	"github.com/ungtb10d/cli/v2/pkg/cmdutil"
    19  	"github.com/spf13/cobra"
    20  )
    21  
    22  func NewCmdIssue(f *cmdutil.Factory) *cobra.Command {
    23  	cmd := &cobra.Command{
    24  		Use:   "issue <command>",
    25  		Short: "Manage issues",
    26  		Long:  `Work with GitHub issues.`,
    27  		Example: heredoc.Doc(`
    28  			$ gh issue list
    29  			$ gh issue create --label bug
    30  			$ gh issue view 123 --web
    31  		`),
    32  		Annotations: map[string]string{
    33  			"IsCore": "true",
    34  			"help:arguments": heredoc.Doc(`
    35  				An issue can be supplied as argument in any of the following formats:
    36  				- by number, e.g. "123"; or
    37  				- by URL, e.g. "https://github.com/OWNER/REPO/issues/123".
    38  			`),
    39  		},
    40  	}
    41  
    42  	cmdutil.EnableRepoOverride(cmd, f)
    43  
    44  	cmd.AddCommand(cmdClose.NewCmdClose(f, nil))
    45  	cmd.AddCommand(cmdCreate.NewCmdCreate(f, nil))
    46  	cmd.AddCommand(cmdList.NewCmdList(f, nil))
    47  	cmd.AddCommand(cmdReopen.NewCmdReopen(f, nil))
    48  	cmd.AddCommand(cmdStatus.NewCmdStatus(f, nil))
    49  	cmd.AddCommand(cmdView.NewCmdView(f, nil))
    50  	cmd.AddCommand(cmdComment.NewCmdComment(f, nil))
    51  	cmd.AddCommand(cmdDelete.NewCmdDelete(f, nil))
    52  	cmd.AddCommand(cmdEdit.NewCmdEdit(f, nil))
    53  	cmd.AddCommand(cmdTransfer.NewCmdTransfer(f, nil))
    54  	cmd.AddCommand(cmdDevelop.NewCmdDevelop(f, nil))
    55  	cmd.AddCommand(cmdPin.NewCmdPin(f, nil))
    56  	cmd.AddCommand(cmdUnpin.NewCmdUnpin(f, nil))
    57  
    58  	return cmd
    59  }