Crates.io | brew |
lib.rs | brew |
version | 0.2.0 |
source | src |
created_at | 2020-08-04 05:35:42.789964 |
updated_at | 2021-11-16 08:07:20.664838 |
description | A rust wrapper around the homebrew package manager cli |
homepage | |
repository | https://github.com/iwahbe/brew-rs |
max_upload_size | |
id | 272763 |
size | 19,427 |
A rust interface to the Homebrew command line app.
The main benefit is a type-safe implementation of brew --json
output. This
shows up in the form of the Package
struct, as well as derivative structs.
There are three entry points, all of which rely on having the brew command line installed.
update()?; // Updates homebrew and all formulea from github, by calling brew update
let jq = Package::new("jq")?; // equivalent to brew info
// not all packages have descriptions
assert_eq!(jq.desc.unwrap(), "Lightweight and flexible command-line JSON processor");
if !jq.is_installed() {
jq.install(Options::new().head().force().env_std())?; // brew install --HEAD --force --env=std
}
The other main ways to access packages are:
let installed_package = all_installed()?; // brew info --installed
let all_packages = all_packages()? // brew info --all