1package cmd23import (4 "fmt"56 "github.com/charmbracelet/soft-serve/pkg/backend"7 "github.com/charmbracelet/soft-serve/pkg/config"8 "github.com/charmbracelet/soft-serve/pkg/proto"9 "github.com/spf13/cobra"10)1112// createCommand is the command for creating a new repository.13func createCommand() *cobra.Command {14 var private bool15 var description string16 var projectName string17 var hidden bool1819 cmd := &cobra.Command{20 Use: "create REPOSITORY",21 Short: "Create a new repository",22 Args: cobra.ExactArgs(1),23 PersistentPreRunE: checkIfCollab,24 RunE: func(cmd *cobra.Command, args []string) error {25 ctx := cmd.Context()26 cfg := config.FromContext(ctx)27 be := backend.FromContext(ctx)28 user := proto.UserFromContext(ctx)29 name := args[0]30 r, err := be.CreateRepository(ctx, name, user, proto.RepositoryOptions{31 Private: private,32 Description: description,33 ProjectName: projectName,34 Hidden: hidden,35 })36 if err != nil {37 return err38 }3940 cloneurl := fmt.Sprintf("%s/%s.git", cfg.SSH.PublicURL, r.Name())41 cmd.PrintErrf("Created repository %s\n", r.Name())42 cmd.Println(cloneurl)4344 return nil45 },46 }4748 cmd.Flags().BoolVarP(&private, "private", "p", false, "make the repository private")49 cmd.Flags().StringVarP(&description, "description", "d", "", "set the repository description")50 cmd.Flags().StringVarP(&projectName, "name", "n", "", "set the project name")51 cmd.Flags().BoolVarP(&hidden, "hidden", "H", false, "hide the repository from the UI")5253 return cmd54}