26 lines
463 B
Go
26 lines
463 B
Go
|
// 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")
|
||
|
}
|