Skip to content

Commit

Permalink
feat(homebrew_upgrades): list only manually installed formulas
Browse files Browse the repository at this point in the history
  • Loading branch information
tmzane committed Mar 30, 2024
1 parent 12d6568 commit 3a61bd6
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions homebrew_upgrades.1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@ def __init__(self, name: str, current_version: str, **_: object):


def main() -> None:
cmd = subprocess.run(
[BREW_PATH, "outdated", "--json"],
check=True,
text=True,
capture_output=True,
)
dump = subprocess.check_output([BREW_PATH, "bundle", "dump", "--file=-", "--formula"], text=True)
manually_installed = {line.split('"')[1] for line in dump.splitlines()} # format: brew "name", ...

outdated = subprocess.check_output([BREW_PATH, "outdated", "--json"], text=True)
data = json.loads(outdated)

data = json.loads(cmd.stdout)
formulas = [Package(**obj) for obj in data["formulae"]]
formulas = [Package(**obj) for obj in data["formulae"] if obj["name"] in manually_installed]
casks = [Package(**obj) for obj in data["casks"]]

total = len(formulas) + len(casks)
Expand Down

0 comments on commit 3a61bd6

Please sign in to comment.