mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 13:46:41 +00:00
fix(xbar/brew-services): handle when no brew services are installed
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# <xbar.title>Brew Services</xbar.title>
|
# <xbar.title>Brew Services</xbar.title>
|
||||||
# <xbar.version>v3.0.0</xbar.version>
|
# <xbar.version>v3.0.1</xbar.version>
|
||||||
# <xbar.author>Jim Myhrberg</xbar.author>
|
# <xbar.author>Jim Myhrberg</xbar.author>
|
||||||
# <xbar.author.github>jimeh</xbar.author.github>
|
# <xbar.author.github>jimeh</xbar.author.github>
|
||||||
# <xbar.desc>List and manage Homebrew Services</xbar.desc>
|
# <xbar.desc>List and manage Homebrew Services</xbar.desc>
|
||||||
@@ -283,6 +283,8 @@ module Brew
|
|||||||
printer.item(status_label(visible)) do |printer|
|
printer.item(status_label(visible)) do |printer|
|
||||||
printer.sep
|
printer.sep
|
||||||
printer.item(':hourglass: Refresh', refresh: true)
|
printer.item(':hourglass: Refresh', refresh: true)
|
||||||
|
|
||||||
|
unless all_services.empty?
|
||||||
printer.sep
|
printer.sep
|
||||||
if visible.stopped.size.positive?
|
if visible.stopped.size.positive?
|
||||||
printer.item(
|
printer.item(
|
||||||
@@ -312,6 +314,8 @@ module Brew
|
|||||||
else
|
else
|
||||||
printer.item("Restart All (#{visible.size} services)")
|
printer.item("Restart All (#{visible.size} services)")
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
printer.sep
|
printer.sep
|
||||||
if use_groups?
|
if use_groups?
|
||||||
printer.item('Disable groups', rpc: ['disable_groups'], refresh: true)
|
printer.item('Disable groups', rpc: ['disable_groups'], refresh: true)
|
||||||
@@ -493,6 +497,8 @@ module Brew
|
|||||||
return @all_services if @all_services
|
return @all_services if @all_services
|
||||||
|
|
||||||
output = cmd(brew_path, 'services', 'list', '--json')
|
output = cmd(brew_path, 'services', 'list', '--json')
|
||||||
|
return ServiceList.new([]) if output == ''
|
||||||
|
|
||||||
data = JSON.parse(output)
|
data = JSON.parse(output)
|
||||||
|
|
||||||
@all_services = ServiceList.new(
|
@all_services = ServiceList.new(
|
||||||
|
|||||||
Reference in New Issue
Block a user