Exemple #1
0
func HandleInit() {
	/* Run the Git command to create a new repository locally */
	cmd := exec.Command("git", "init", *Init)
	cmd.Stdout = os.Stdout
	err := cmd.Run()
	if err != nil {
		log.Fatal(err)
	}
	crr, err := webhooks.CreateRepository(conf, *Init, nil)
	if err != nil {
		log.Fatal(err)
	}
	/* Move into the new sub directory */
	err = os.Chdir(*Init)
	if err != nil {
		log.Fatal(err)
	}
	/* Add the remote as the origin of the new repository */
	cmd = exec.Command(
		"git", "remote", "add", "origin", conf.GitURL+crr.PathWithNS,
	)
	cmd.Stdout = os.Stdout
	err = cmd.Run()
	if err != nil {
		log.Fatal(err)
	}
	return

}
Exemple #2
0
func HandleCreate() {
	crr, err := webhooks.CreateRepository(conf, *Create, nil)
	if err != nil {
		fmt.Println("Error creating repository: " + err.Error())
		return
	}
	fmt.Printf("New repository created with ID: %d\n", crr.ID)
}