mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 13:46:41 +00:00
Compare commits
2 Commits
cb7ff641f0
...
e252161208
| Author | SHA1 | Date | |
|---|---|---|---|
|
e252161208
|
|||
|
9244c7f92b
|
@@ -2,7 +2,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# <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.github>jimeh</xbar.author.github>
|
||||
# <xbar.desc>List and manage Homebrew Services</xbar.desc>
|
||||
@@ -283,35 +283,39 @@ module Brew
|
||||
printer.item(status_label(visible)) do |printer|
|
||||
printer.sep
|
||||
printer.item(':hourglass: Refresh', refresh: true)
|
||||
printer.sep
|
||||
if visible.stopped.size.positive?
|
||||
printer.item(
|
||||
"Start All (#{visible.stopped.size} services)",
|
||||
terminal: false, refresh: true,
|
||||
shell: [brew_path, 'services', 'start', '--all']
|
||||
)
|
||||
else
|
||||
printer.item("Start All (#{visible.stopped.size} services)")
|
||||
end
|
||||
if visible.started.size.positive?
|
||||
printer.item(
|
||||
"Stop All (#{visible.started.size} services)",
|
||||
terminal: false, refresh: true,
|
||||
shell: [brew_path, 'services', 'stop', '--all']
|
||||
)
|
||||
else
|
||||
printer.item("Stop All (#{visible.started.size} services)")
|
||||
end
|
||||
if visible.size.positive?
|
||||
count = visible.started.size + visible.stopped.size
|
||||
printer.item(
|
||||
"Restart All (#{count} services)",
|
||||
terminal: false, refresh: true,
|
||||
shell: [brew_path, 'services', 'restart', '--all']
|
||||
)
|
||||
else
|
||||
printer.item("Restart All (#{visible.size} services)")
|
||||
|
||||
unless all_services.empty?
|
||||
printer.sep
|
||||
if visible.stopped.size.positive?
|
||||
printer.item(
|
||||
"Start All (#{visible.stopped.size} services)",
|
||||
terminal: false, refresh: true,
|
||||
shell: [brew_path, 'services', 'start', '--all']
|
||||
)
|
||||
else
|
||||
printer.item("Start All (#{visible.stopped.size} services)")
|
||||
end
|
||||
if visible.started.size.positive?
|
||||
printer.item(
|
||||
"Stop All (#{visible.started.size} services)",
|
||||
terminal: false, refresh: true,
|
||||
shell: [brew_path, 'services', 'stop', '--all']
|
||||
)
|
||||
else
|
||||
printer.item("Stop All (#{visible.started.size} services)")
|
||||
end
|
||||
if visible.size.positive?
|
||||
count = visible.started.size + visible.stopped.size
|
||||
printer.item(
|
||||
"Restart All (#{count} services)",
|
||||
terminal: false, refresh: true,
|
||||
shell: [brew_path, 'services', 'restart', '--all']
|
||||
)
|
||||
else
|
||||
printer.item("Restart All (#{visible.size} services)")
|
||||
end
|
||||
end
|
||||
|
||||
printer.sep
|
||||
if use_groups?
|
||||
printer.item('Disable groups', rpc: ['disable_groups'], refresh: true)
|
||||
@@ -493,6 +497,8 @@ module Brew
|
||||
return @all_services if @all_services
|
||||
|
||||
output = cmd(brew_path, 'services', 'list', '--json')
|
||||
return ServiceList.new([]) if output == ''
|
||||
|
||||
data = JSON.parse(output)
|
||||
|
||||
@all_services = ServiceList.new(
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# <xbar.title>Brew Updates</xbar.title>
|
||||
# <xbar.version>v2.3.1</xbar.version>
|
||||
# <xbar.version>v2.3.2</xbar.version>
|
||||
# <xbar.author>Jim Myhrberg</xbar.author>
|
||||
# <xbar.author.github>jimeh</xbar.author.github>
|
||||
# <xbar.desc>List and manage outdated Homebrew formulas and casks</xbar.desc>
|
||||
@@ -12,6 +12,13 @@
|
||||
#
|
||||
# <xbar.var>string(VAR_BREW_PATH="/usr/local/bin/brew"): Path to "brew" executable.</xbar.var>
|
||||
|
||||
# rubocop:disable Lint/ShadowingOuterLocalVariable
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
# rubocop:disable Metrics/BlockLength
|
||||
# rubocop:disable Metrics/ClassLength
|
||||
# rubocop:disable Metrics/CyclomaticComplexity
|
||||
# rubocop:disable Metrics/MethodLength
|
||||
# rubocop:disable Metrics/PerceivedComplexity
|
||||
# rubocop:disable Style/IfUnlessModifier
|
||||
|
||||
require 'open3'
|
||||
@@ -185,7 +192,7 @@ module Brew
|
||||
|
||||
def brew_update
|
||||
cmd(brew_path, 'update')
|
||||
rescue CommandError => e
|
||||
rescue CommandError
|
||||
# Continue as if nothing happened when brew update fails, as it likely
|
||||
# to be due to another update process is already running.
|
||||
end
|
||||
@@ -412,3 +419,10 @@ rescue StandardError => e
|
||||
end
|
||||
|
||||
# rubocop:enable Style/IfUnlessModifier
|
||||
# rubocop:enable Metrics/PerceivedComplexity
|
||||
# rubocop:enable Metrics/MethodLength
|
||||
# rubocop:enable Metrics/CyclomaticComplexity
|
||||
# rubocop:enable Metrics/ClassLength
|
||||
# rubocop:enable Metrics/BlockLength
|
||||
# rubocop:enable Metrics/AbcSize
|
||||
# rubocop:enable Lint/ShadowingOuterLocalVariable
|
||||
|
||||
Reference in New Issue
Block a user