mirror of
https://github.com/sern-handler/cli
synced 2026-06-18 13:52:24 +00:00
35 lines
596 B
Go
35 lines
596 B
Go
package initialize
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"strings"
|
|
|
|
"github.com/go-git/go-git/v5"
|
|
)
|
|
|
|
func cloneRepository(name string, language string) {
|
|
_, err := git.PlainClone("templates", false, &git.CloneOptions{
|
|
URL: "https://github.com/sern-handler/templates",
|
|
Progress: os.Stdout,
|
|
})
|
|
|
|
if err != nil {
|
|
fmt.Println("Couldn't install the template, exiting.")
|
|
|
|
return
|
|
}
|
|
|
|
err = os.Rename("templates/templates/"+strings.ToLower(language), name)
|
|
|
|
if err != nil {
|
|
fmt.Println("Couldn't install the template, exiting.")
|
|
}
|
|
|
|
err = os.RemoveAll("templates")
|
|
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|