Class reference
Brew

Brew Reference

BrewError

The BrewError class represents an error that occurred during a Brew operation.

Properties
NameTypeDescription
messagestringThe error message
namestringThe name of the error (e.g., "Brew Error: ...")

BrewPackageOptions

The options for configuring a Brew package.

NameTypeRequiredDescription
namestring | string[]YesThe name(s) of the package(s) to install/uninstall
caskbooleanYesWhether the package(s) is a cask
silentbooleanYesWhether to print the command output to stdout
update_homebrewbooleanYesWhether to update Homebrew before installing/uninstalling
upgrade_allbooleanYesWhether to upgrade all Brew packages before installing/uninstalling

BrewSafeError

The response object returned by Brew operations.

NameTypeDescription
successbooleanWhether the operation was successful
errorBrewError | nullThe error that occurred (if any)

BrewPackage Class

The BrewPackage class provides methods for interacting with Brew packages.

Constructor

The BrewPackage class constructor accepts a BrewPackageOptions object.

import { BrewPackage, BrewPackageOptions } from "@vaibhavvenkat/aacod";
 
const opts: BrewPackageOptions = {
    name: "package-name",
    cask: false,
    silent: false,
    update_homebrew: true,
    upgrade_all: true,
};
 
const brewPackage = new BrewPackage(opts);

Methods

upgradeAllPkgs(): Promise<void>

Upgrades all Brew packages.

await brewPackage.upgradeAllPkgs();
updateHomebrew(): Promise<void>

Updates Homebrew.

await brewPackage.updateHomebrew();
safeInstall(): Promise<BrewSafeError>

Safely installs a Brew package without throwing an error.

const res: BrewSafeError = await brewPackage.safeInstall();
install(): Promise<void>

Installs a Brew package.

await brewPackage.install();
safeUninstall(): Promise<BrewSafeError>

Safely uninstalls a Brew package without throwing an error.

const res: BrewSafeError = await brewPackage.safeUninstall();
uninstall(): Promise<void>

Uninstalls a Brew package.

await brewPackage.uninstall();