add setting to include self-updating casks (--greedy), on by default
brew outdated normally skips casks that auto-update themselves; with includeGreedyCasks enabled (the default) BrewBar passes --greedy so they show up too. Toggling the checkbox refetches immediately since the list semantics change. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
617e07d53d
commit
bd19bee52e
|
|
@ -245,7 +245,10 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||
func fetchOutdated() {
|
||||
setMenuBarIcon("brewbar-updating")
|
||||
|
||||
runBrew("outdated") { output in
|
||||
// --greedy also lists casks that self-update (brew skips them by default)
|
||||
let command = Settings.includeGreedyCasks ? "outdated --greedy" : "outdated"
|
||||
|
||||
runBrew(command) { output in
|
||||
let lines = BrewParser.parseOutdated(output)
|
||||
|
||||
self.cachedOutdated = lines
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ class SettingsWindowController: NSWindowController {
|
|||
var intervalPopup: NSPopUpButton!
|
||||
var customMinutesField: NSTextField!
|
||||
var launchAtLoginCheckbox: NSButton!
|
||||
var greedyCheckbox: NSButton!
|
||||
|
||||
convenience init(appDelegate: AppDelegate) {
|
||||
let window = NSWindow(
|
||||
|
|
@ -74,9 +75,16 @@ class SettingsWindowController: NSWindowController {
|
|||
action: #selector(toggleLaunchAtLogin(_:))
|
||||
)
|
||||
|
||||
greedyCheckbox = NSButton(
|
||||
checkboxWithTitle: "Include self-updating casks (--greedy)",
|
||||
target: self,
|
||||
action: #selector(toggleGreedy(_:))
|
||||
)
|
||||
|
||||
let stack = NSStackView(views: [
|
||||
frequencyRow,
|
||||
customRow,
|
||||
greedyCheckbox,
|
||||
separator(),
|
||||
launchAtLoginCheckbox,
|
||||
])
|
||||
|
|
@ -113,6 +121,7 @@ class SettingsWindowController: NSWindowController {
|
|||
// SMAppService is the source of truth — the user may have changed
|
||||
// this in System Settings > Login Items while we weren't looking
|
||||
launchAtLoginCheckbox.state = SMAppService.mainApp.status == .enabled ? .on : .off
|
||||
greedyCheckbox.state = Settings.includeGreedyCasks ? .on : .off
|
||||
}
|
||||
|
||||
func separator() -> NSBox {
|
||||
|
|
@ -145,6 +154,11 @@ class SettingsWindowController: NSWindowController {
|
|||
syncUI()
|
||||
}
|
||||
|
||||
@objc func toggleGreedy(_ sender: NSButton) {
|
||||
Settings.includeGreedyCasks = sender.state == .on
|
||||
appDelegate?.fetchOutdated() // the list contents just changed meaning
|
||||
}
|
||||
|
||||
@objc func toggleLaunchAtLogin(_ sender: NSButton) {
|
||||
do {
|
||||
if sender.state == .on {
|
||||
|
|
|
|||
Loading…
Reference in a new issue