diff --git a/homebrew_upgrades.1d.py b/homebrew_upgrades.1d.py index 317b85a..121d28d 100755 --- a/homebrew_upgrades.1d.py +++ b/homebrew_upgrades.1d.py @@ -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)