micnncim / homebrew-go

Homebrew Go client

Home Page:https://godoc.org/github.com/micnncim/homebrew-go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

homebrew-go

GoDoc

A Go client package for Homebrew.

Usage

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

Example

See an example.

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 to use this package.

License

MIT

About

Homebrew Go client

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


Languages

Language:Go 100.0%