From a84e07f87aeed11836f86901016f54548158bc3a Mon Sep 17 00:00:00 2001 From: Will Eccles Date: Wed, 18 Jan 2023 21:46:48 -0500 Subject: [PATCH] feat: add homebrew support --- README.md | 4 ++-- cpm | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 70db4dd..229a890 100644 --- a/README.md +++ b/README.md @@ -37,21 +37,21 @@ sudo make install - emerge (Gentoo) - dnf (Fedora) - guix (non-system-wide Guix) +- Homebrew - lunar (Lunar) - MacPorts (macOS) - pacman (Arch) +- pkg (FreeBSD and OpenBSD) - slackpkg (Slackware) - sorcery (Source Mage) - urpmi (Mageia) - xbps (Void) - zypper (OpenSUSE) -- pkg (FreeBSD and OpenBSD) ## Explicitly unsupported package managers - Cargo - Flatpak -- Homebrew - Nix - NPM - Pip diff --git a/cpm b/cpm index 6817945..c9da2d1 100755 --- a/cpm +++ b/cpm @@ -312,6 +312,22 @@ _macports() { esac } +_brew() { + case "$OP" in + install) brew install "$@";; + remove) brew uninstall "$@";; + list) brew list;; + count) brew list | tot;; + update) brew update;; + upgrade) brew update && brew upgrade;; + search) brew search "$@";; + show) brew info "$@";; + files) pem "unsupported operation";; + from) pem "unsupported operation";; + clean) brew cleanup;; + esac +} + _xbps() { case "$OP" in install) su_do xbps-install "$@";; @@ -527,8 +543,7 @@ else if has port; then _macports "$@" elif has brew; then - pem "Homebrew is not supported [wontfix]" - exit 1 + _brew "$@" else pem "No valid package manager detected." exit 1