1package repo
2
3import (
4	"github.com/MakeNowJust/heredoc"
5	repoArchiveCmd "github.com/cli/cli/v2/pkg/cmd/repo/archive"
6	repoCloneCmd "github.com/cli/cli/v2/pkg/cmd/repo/clone"
7	repoCreateCmd "github.com/cli/cli/v2/pkg/cmd/repo/create"
8	creditsCmd "github.com/cli/cli/v2/pkg/cmd/repo/credits"
9	repoDeleteCmd "github.com/cli/cli/v2/pkg/cmd/repo/delete"
10	repoEditCmd "github.com/cli/cli/v2/pkg/cmd/repo/edit"
11	repoForkCmd "github.com/cli/cli/v2/pkg/cmd/repo/fork"
12	gardenCmd "github.com/cli/cli/v2/pkg/cmd/repo/garden"
13	repoListCmd "github.com/cli/cli/v2/pkg/cmd/repo/list"
14	repoRenameCmd "github.com/cli/cli/v2/pkg/cmd/repo/rename"
15	repoSyncCmd "github.com/cli/cli/v2/pkg/cmd/repo/sync"
16	repoViewCmd "github.com/cli/cli/v2/pkg/cmd/repo/view"
17	"github.com/cli/cli/v2/pkg/cmdutil"
18	"github.com/spf13/cobra"
19)
20
21func NewCmdRepo(f *cmdutil.Factory) *cobra.Command {
22	cmd := &cobra.Command{
23		Use:   "repo <command>",
24		Short: "Create, clone, fork, and view repositories",
25		Long:  `Work with GitHub repositories`,
26		Example: heredoc.Doc(`
27			$ gh repo create
28			$ gh repo clone cli/cli
29			$ gh repo view --web
30		`),
31		Annotations: map[string]string{
32			"IsCore": "true",
33			"help:arguments": heredoc.Doc(`
34				A repository can be supplied as an argument in any of the following formats:
35				- "OWNER/REPO"
36				- by URL, e.g. "https://github.com/OWNER/REPO"
37			`),
38		},
39	}
40
41	cmd.AddCommand(repoViewCmd.NewCmdView(f, nil))
42	cmd.AddCommand(repoForkCmd.NewCmdFork(f, nil))
43	cmd.AddCommand(repoCloneCmd.NewCmdClone(f, nil))
44	cmd.AddCommand(repoCreateCmd.NewCmdCreate(f, nil))
45	cmd.AddCommand(repoEditCmd.NewCmdEdit(f, nil))
46	cmd.AddCommand(repoListCmd.NewCmdList(f, nil))
47	cmd.AddCommand(repoSyncCmd.NewCmdSync(f, nil))
48	cmd.AddCommand(creditsCmd.NewCmdRepoCredits(f, nil))
49	cmd.AddCommand(gardenCmd.NewCmdGarden(f, nil))
50	cmd.AddCommand(repoRenameCmd.NewCmdRename(f, nil))
51	cmd.AddCommand(repoDeleteCmd.NewCmdDelete(f, nil))
52	cmd.AddCommand(repoArchiveCmd.NewCmdArchive(f, nil))
53
54	return cmd
55}
56