<commit_before>-- Homebrew menubar
local Homebrew = {
    menubar  = hs.menubar.new(),
    items    = {},
    disabled = false,
    notified = false,
}

function Homebrew:loadOutdated()
    self.items = {}
    local pipe = io.popen('/usr/local/bin/brew outdated -1 --quiet', 'r')
    for item in pipe:lines() do
        table.insert(self.items, item)
    end
    pipe:close()

    if next(self.items) == nil then
        self.disabled = true
        self.notified = false
        self.menubar:removeFromMenuBar()
        self.menubar:setTooltip("Homebrew")
    else
        local msg = string.format("%d updated formula%s available", #self.items, plural(self.items))
        self.disabled = false
        self.menubar:returnToMenuBar()
        self.menubar:setTooltip(msg)
        if not self.notified then
            hs.notify.show('Homebrew', msg, table.concat(self.items, ', '))
            self.notified = true
        end
    end<commit_msg>hammerspoon/brew: Ignore pinned formulas<commit_after>-- Homebrew menubar
local Homebrew = {
    menubar  = hs.menubar.new(),
    items    = {},
    disabled = false,
    notified = false,
}

function Homebrew:loadOutdated()
    self.items = {}
    local pipe = io.popen('/usr/local/bin/brew outdated -1 -v | grep -v pinned | cut -f 1 -d " "', 'r')
    for item in pipe:lines() do
        table.insert(self.items, item)
    end
    pipe:close()

    if next(self.items) == nil then
        self.disabled = true
        self.notified = false
        self.menubar:removeFromMenuBar()
        self.menubar:setTooltip("Homebrew")
    else
        local msg = string.format("%d updated formula%s available", #self.items, plural(self.items))
        self.disabled = false
        self.menubar:returnToMenuBar()
        self.menubar:setTooltip(msg)
        if not self.notified then
            hs.notify.show('Homebrew', msg, table.concat(self.items, ', '))
            self.notified = true
        end
    end
{'fraction_non_alphanumeric': 0.12608918503331626, 'fraction_numerical': 0.0015376729882111738, 'mean_word_length': 2.3655172413793104, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4604057', 'n_tokens_mistral': 626, 'n_tokens_neox': 615, 'n_words': 139}