repo.go

 1package main
 2
 3import "github.com/spf13/cobra"
 4
 5func repoCommand() *cobra.Command {
 6	cmd := &cobra.Command{
 7		Use:     "repo",
 8		Aliases: []string{"repos", "repository", "repositories"},
 9		Short:   "Manage repositories",
10	}
11
12	cmd.AddCommand(
13	// blobCommand(),
14	// branchCommand(),
15	// collabCommand(),
16	// createCommand(),
17	// deleteCommand(),
18	// descriptionCommand(),
19	// hiddenCommand(),
20	// importCommand(),
21	// listCommand(),
22	// mirrorCommand(),
23	// privateCommand(),
24	// projectName(),
25	// renameCommand(),
26	// tagCommand(),
27	// treeCommand(),
28	)
29	//
30	// cmd.AddCommand(
31	// 	&cobra.Command{
32	// 		Use:               "info REPOSITORY",
33	// 		Short:             "Get information about a repository",
34	// 		Args:              cobra.ExactArgs(1),
35	// 		PersistentPreRunE: checkIfReadable,
36	// 		RunE: func(cmd *cobra.Command, args []string) error {
37	// 			ctx := cmd.Context()
38	// 			be, _ := fromContext(cmd)
39	// 			rn := args[0]
40	// 			rr, err := be.Repository(ctx, rn)
41	// 			if err != nil {
42	// 				return err
43	// 			}
44	//
45	// 			r, err := rr.Open()
46	// 			if err != nil {
47	// 				return err
48	// 			}
49	//
50	// 			head, err := r.HEAD()
51	// 			if err != nil {
52	// 				return err
53	// 			}
54	//
55	// 			branches, _ := r.Branches()
56	// 			tags, _ := r.Tags()
57	// 			cmd.Println("Project Name:", rr.ProjectName())
58	// 			cmd.Println("Repository:", rr.Name())
59	// 			cmd.Println("Description:", rr.Description())
60	// 			cmd.Println("Private:", rr.IsPrivate())
61	// 			cmd.Println("Hidden:", rr.IsHidden())
62	// 			cmd.Println("Mirror:", rr.IsMirror())
63	// 			cmd.Println("Default Branch:", head.Name().Short())
64	// 			if len(branches) > 0 {
65	// 				cmd.Println("Branches:")
66	// 				for _, b := range branches {
67	// 					cmd.Println("  -", b)
68	// 				}
69	// 			}
70	// 			if len(tags) > 0 {
71	// 				cmd.Println("Tags:")
72	// 				for _, t := range tags {
73	// 					cmd.Println("  -", t)
74	// 				}
75	// 			}
76	//
77	// 			return nil
78	// 		},
79	// 	},
80	// )
81
82	return cmd
83}