fetch from git repos
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
repos/
|
||||
examples/
|
||||
28
micro-functions.go
Normal file
28
micro-functions.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func main() {
|
||||
repoURL := "https://git.greatrsingh.in/sudo-rsingh/examples.git"
|
||||
repoName := path.Base(repoURL)
|
||||
repoName = strings.TrimSuffix(repoName, ".git")
|
||||
targetDir := "repo/" + repoName
|
||||
|
||||
cmd := exec.Command("git", "clone", repoURL, targetDir)
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
|
||||
err := cmd.Run()
|
||||
if err != nil {
|
||||
fmt.Println("Error: ", err)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println("Clone Completed.")
|
||||
}
|
||||
Reference in New Issue
Block a user