Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thombashi/go-gitexec
Thin wrapper to execute git commands in Go.
https://github.com/thombashi/go-gitexec
git-wrapper golang-library
Last synced: 3 months ago
JSON representation
Thin wrapper to execute git commands in Go.
- Host: GitHub
- URL: https://github.com/thombashi/go-gitexec
- Owner: thombashi
- License: mit
- Created: 2024-06-16T14:45:56.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-07-14T10:14:54.000Z (6 months ago)
- Last Synced: 2024-07-14T11:00:01.911Z (6 months ago)
- Topics: git-wrapper, golang-library
- Language: Go
- Homepage: https://pkg.go.dev/github.com/thombashi/go-gitexec
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-gitexec
Thin wrapper to execute git commands in Go.
[![Go Reference](https://pkg.go.dev/badge/github.com/thombashi/go-gitexec.svg)](https://pkg.go.dev/github.com/thombashi/go-gitexec)
[![Go Report Card](https://goreportcard.com/badge/github.com/thombashi/go-gitexec)](https://goreportcard.com/report/github.com/thombashi/go-gitexec)
[![CI](https://github.com/thombashi/go-gitexec/actions/workflows/ci.yaml/badge.svg)](https://github.com/thombashi/go-gitexec/actions/workflows/ci.yaml)
[![CodeQL](https://github.com/thombashi/go-gitexec/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/thombashi/go-gitexec/actions/workflows/github-code-scanning/codeql)## Usage
### Basic Usage
```go
import (
"fmt"
"strings""github.com/thombashi/go-gitexec"
)func ExampleRunGit() {
executor, err := gitexec.New(&gitexec.Params{})
if err != nil {
panic(err)
}result, err := executor.RunGit("status")
if err != nil {
panic(err)
}fmt.Printf(result.Stdout.String())
}
```### Usage: with environment variables
```go
import (
"fmt"
"os"
"strings""github.com/thombashi/go-gitexec"
)func main() {
executor, err := gitexec.New(&gitexec.Params{
Env: []string{
"GIT_AUTHOR_NAME=John Doe",
"[email protected]",
},
})
if err != nil {
panic(err)
}result, err := executor.RunGit("var", "GIT_AUTHOR_IDENT")
if err != nil {
panic(err)
}fmt.Printf(result.Stdout.String())
}
```