courgette/internal/actions/git.go

26 lines
463 B
Go
Raw Normal View History

2024-09-01 17:31:30 +00:00
// Lightweight wrapper around `git`.
package actions
import (
"os"
"os/exec"
)
type CliClient interface {
Clone(url string, destination string) error
}
type GitClient struct{}
func (g GitClient) exec(args ...string) error {
cmd := exec.Command("git", args...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
return cmd.Run()
}
func (g GitClient) Clone(url string, destination string) error {
return g.exec("clone", url, destination, "--depth", "1")
}