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