1package cmd
2
3import "github.com/spf13/cobra"
4
5func deleteCommand() *cobra.Command {
6 cmd := &cobra.Command{
7 Use: "delete REPOSITORY",
8 Aliases: []string{"del", "remove", "rm"},
9 Short: "Delete a repository",
10 Args: cobra.ExactArgs(1),
11 PersistentPreRunE: checkIfCollab,
12 RunE: func(cmd *cobra.Command, args []string) error {
13 ctx := cmd.Context()
14 be, _ := fromContext(cmd)
15 name := args[0]
16 if err := be.DeleteRepository(ctx, name); err != nil {
17 return err
18 }
19 return nil
20 },
21 }
22 return cmd
23}