fetch from git repos

This commit is contained in:
2026-02-28 06:06:11 +05:30
commit e26fa0945d
3 changed files with 33 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
repos/
examples/

3
go.mod Normal file
View File

@@ -0,0 +1,3 @@
module silinode.in/micro-functions
go 1.25.7

28
micro-functions.go Normal file
View 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.")
}