An open API service indexing awesome lists of open source software.

https://github.com/micnncim/homebrew-go

Homebrew Go client
https://github.com/micnncim/homebrew-go

Last synced: 2 months ago
JSON representation

Homebrew Go client

Awesome Lists containing this project

README

        

# homebrew-go

[![GoDoc][godoc-badge]][godoc]

A Go client package for Homebrew.

## Usage

```
import "github.com/micnncim/homebrew-go"
```

## Example

See an [example](./example).

```go
func main() {
stdout := &bytes.Buffer{}
stderr := &bytes.Buffer{}
h := homebrew.New(
homebrew.WithStdout(stdout),
homebrew.WithStderr(stderr),
)

ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute)
defer cancel()
if err := h.Install(ctx, "jq", homebrew.InstallOptionVerbose, homebrew.InstallOptionForce); err != nil {
log.Fatal(err)
}
fmt.Println(stdout.String())
fmt.Println(stderr.String())
}
```

## Supported commands

Currently only *essential commands*.

- `brew install [options] formula`
- `brew uninstall, rm, remove [options] formula`
- `brew list, ls [options] [formula]`
- `brew search [options] [text|/text/]`

## Dependency

Need to install [Homebrew](https://docs.brew.sh/) to use this package.

## License

MIT

[godoc]: https://godoc.org/github.com/micnncim/homebrew-go

[godoc-badge]: https://img.shields.io/badge/godoc.org-reference-blue.svg