github.com/abdfnx/gh-api@v0.0.0-20210414084727-f5432eec23b8/pkg/cmd/repo/repo.go (about)

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