collab.go

 1package cmd
 2
 3import (
 4	"github.com/spf13/cobra"
 5)
 6
 7func collabCommand() *cobra.Command {
 8	cmd := &cobra.Command{
 9		Use:     "collab",
10		Aliases: []string{"collabs", "collaborator", "collaborators"},
11		Short:   "Manage collaborators",
12	}
13
14	cmd.AddCommand(
15	// collabAddCommand(),
16	// collabRemoveCommand(),
17	// collabListCommand(),
18	)
19
20	return cmd
21}
22
23//
24// func collabAddCommand() *cobra.Command {
25// 	cmd := &cobra.Command{
26// 		Use:               "add REPOSITORY USERNAME",
27// 		Short:             "Add a collaborator to a repo",
28// 		Args:              cobra.ExactArgs(2),
29// 		PersistentPreRunE: checkIfCollab,
30// 		RunE: func(cmd *cobra.Command, args []string) error {
31// 			be, _ := fromContext(cmd)
32// 			repo := args[0]
33// 			username := args[1]
34//
35// 			return be.AddCollaborator(ctx, repo, username)
36// 		},
37// 	}
38//
39// 	return cmd
40// }
41//
42// func collabRemoveCommand() *cobra.Command {
43// 	cmd := &cobra.Command{
44// 		Use:               "remove REPOSITORY USERNAME",
45// 		Args:              cobra.ExactArgs(2),
46// 		Short:             "Remove a collaborator from a repo",
47// 		PersistentPreRunE: checkIfCollab,
48// 		RunE: func(cmd *cobra.Command, args []string) error {
49// 			be, _ := fromContext(cmd)
50// 			repo := args[0]
51// 			username := args[1]
52//
53// 			return be.RemoveCollaborator(repo, username)
54// 		},
55// 	}
56//
57// 	return cmd
58// }
59//
60// func collabListCommand() *cobra.Command {
61// 	cmd := &cobra.Command{
62// 		Use:               "list REPOSITORY",
63// 		Short:             "List collaborators for a repo",
64// 		Args:              cobra.ExactArgs(1),
65// 		PersistentPreRunE: checkIfCollab,
66// 		RunE: func(cmd *cobra.Command, args []string) error {
67// 			be, _ := fromContext(cmd)
68// 			repo := args[0]
69// 			collabs, err := be.Collaborators(repo)
70// 			if err != nil {
71// 				return err
72// 			}
73//
74// 			for _, c := range collabs {
75// 				cmd.Println(c)
76// 			}
77//
78// 			return nil
79// 		},
80// 	}
81//
82// 	return cmd
83// }