mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 13:46:41 +00:00
feat(xbar/brew-services): show Start command first if relevant
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>v2.2.1</xbar.version>
|
# <xbar.version>v2.2.2</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>
|
||||||
@@ -310,6 +310,13 @@ module Brew
|
|||||||
end
|
end
|
||||||
|
|
||||||
printer.item("#{icon} #{service.name}") do |printer|
|
printer.item("#{icon} #{service.name}") do |printer|
|
||||||
|
if service.stopped? || service.unknown_status?
|
||||||
|
printer.item(
|
||||||
|
'Start',
|
||||||
|
terminal: false, refresh: true,
|
||||||
|
shell: [brew_path, 'services', 'start', service.name]
|
||||||
|
)
|
||||||
|
end
|
||||||
if service.started? || service.error? || service.unknown_status?
|
if service.started? || service.error? || service.unknown_status?
|
||||||
printer.item(
|
printer.item(
|
||||||
'Stop',
|
'Stop',
|
||||||
@@ -322,13 +329,6 @@ module Brew
|
|||||||
shell: [brew_path, 'services', 'restart', service.name]
|
shell: [brew_path, 'services', 'restart', service.name]
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
if service.stopped? || service.unknown_status?
|
|
||||||
printer.item(
|
|
||||||
'Start',
|
|
||||||
terminal: false, refresh: true,
|
|
||||||
shell: [brew_path, 'services', 'start', service.name]
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
printer.sep
|
printer.sep
|
||||||
printer.item("State: #{service.status}")
|
printer.item("State: #{service.status}")
|
||||||
|
|||||||
Reference in New Issue
Block a user