-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add brew bundle services
helper
#19552
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good so far! What happens if there's an existing service already running, will this automatically stop it? If not: that seems desirable.
|
||
# We parse from a command invocation so that brew wrappers can invoke special actions | ||
# for the elevated nature of `brew services` | ||
output = Utils.safe_popen_read(HOMEBREW_BREW_FILE, "services", "info", "--json", formula.full_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does brew services list --json
contain the information we need? If so, would be nice to use that instead. If not, maybe it'd be nice to add that information in there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
list
is a small subset of info
. I use 4 fields from the JSON, 3 of which are not in list
.
Could maybe add them though we'd be near the point of making it not a subset anymore.
I think maybe a better option is to allow info
to take in multiple arguments: #19565
@@ -53,6 +53,7 @@ def self.output(hash, verbose:) | |||
return out unless verbose | |||
|
|||
out += "File: #{hash[:file]} #{pretty_bool(hash[:file].present?)}\n" | |||
out += "Registered at login: #{pretty_bool(hash[:registered])}\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could/should this be in list
instead/as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably doesn't really need to be.
The information is technically already there in list
- if it's in LaunchAgents
then it's registered. It's just not very good to consume as a JSON API.
Technically doesn't need to be in info
non-JSON either but it's in the verbose section which is probably a right fit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thinking of the benefits for list
are that you can get this information for all formulae in a single call.
Not currently. Not sure how such CLI should look. |
Don't feel strongly about the API. I agree with not removing the service if possible but, if it's not, it feels more sensible to remove it. I think for |
A nice shortcut to quickly start and stop all formulae with services in your Brewfile. This makes it nicer if you have e.g. differing database versions (which often still share the same port) between projects.