cmd/services: manpage fixes

This commit is contained in:
Eric Knibbe 2025-08-16 00:34:26 -04:00
parent 12e4c8a05e
commit 468d4665fb
No known key found for this signature in database
4 changed files with 39 additions and 41 deletions

View File

@ -25,27 +25,27 @@ module Homebrew
If `sudo` is passed, operate on `/Library/LaunchDaemons` or `/usr/lib/systemd/system` (started at boot). If `sudo` is passed, operate on `/Library/LaunchDaemons` or `/usr/lib/systemd/system` (started at boot).
Otherwise, operate on `~/Library/LaunchAgents` or `~/.config/systemd/user` (started at login). Otherwise, operate on `~/Library/LaunchAgents` or `~/.config/systemd/user` (started at login).
[`sudo`] `brew services` [`list`] (`--json`) (`--debug`): [`sudo`] `brew services` [`list`] [`--json`] [`--debug`]:
List information about all managed services for the current user (or root). List information about all managed services for the current user (or root).
Provides more output from Homebrew and `launchctl`(1) or `systemctl`(1) if run with `--debug`. Provides more output from Homebrew and `launchctl`(1) or `systemctl`(1) if run with `--debug`.
[`sudo`] `brew services info` (<formula>|`--all`|`--json`): [`sudo`] `brew services info` (<formula>|`--all`) [`--json`]:
List all managed services for the current user (or root). List all managed services for the current user (or root).
[`sudo`] `brew services run` (<formula>|`--all`|`--file=`): [`sudo`] `brew services run` (<formula>|`--all`) [`--file=`]:
Run the service <formula> without registering to launch at login (or boot). Run the service <formula> without registering to launch at login (or boot).
[`sudo`] `brew services start` (<formula>|`--all`|`--file=`): [`sudo`] `brew services start` (<formula>|`--all`) [`--file=`]:
Start the service <formula> immediately and register it to launch at login (or boot). Start the service <formula> immediately and register it to launch at login (or boot).
[`sudo`] `brew services stop` (`--keep`) (`--no-wait`|`--max-wait=`) (<formula>|`--all`): [`sudo`] `brew services stop` [`--keep`] [`--no-wait`|`--max-wait=`] (<formula>|`--all`):
Stop the service <formula> immediately and unregister it from launching at login (or boot), Stop the service <formula> immediately and unregister it from launching at login (or boot),
unless `--keep` is specified. unless `--keep` is specified.
[`sudo`] `brew services kill` (<formula>|`--all`): [`sudo`] `brew services kill` (<formula>|`--all`):
Stop the service <formula> immediately but keep it registered to launch at login (or boot). Stop the service <formula> immediately but keep it registered to launch at login (or boot).
[`sudo`] `brew services restart` (<formula>|`--all`|`--file=`): [`sudo`] `brew services restart` (<formula>|`--all`) [`--file=`]:
Stop (if necessary) and start the service <formula> immediately and register it to launch at login (or boot). Stop (if necessary) and start the service <formula> immediately and register it to launch at login (or boot).
[`sudo`] `brew services cleanup`: [`sudo`] `brew services cleanup`:
@ -58,15 +58,16 @@ module Homebrew
flag "--max-wait=", flag "--max-wait=",
description: "Wait at most this many seconds for `stop` to finish stopping a service. " \ description: "Wait at most this many seconds for `stop` to finish stopping a service. " \
"Defaults to 60. Set this to zero (0) seconds to wait indefinitely." "Defaults to 60. Set this to zero (0) seconds to wait indefinitely."
switch "--all",
description: "Run <subcommand> on all services."
switch "--json",
description: "Output as JSON."
switch "--no-wait", switch "--no-wait",
description: "Don't wait for `stop` to finish stopping the service." description: "Don't wait for `stop` to finish stopping the service."
switch "--keep", switch "--keep",
description: "When stopped, don't unregister the service from launching at login (or boot)." description: "When stopped, don't unregister the service from launching at login (or boot)."
switch "--all",
description: "Run <subcommand> on all services."
switch "--json",
description: "Output as JSON."
conflicts "--all", "--file"
conflicts "--max-wait=", "--no-wait" conflicts "--max-wait=", "--no-wait"
named_args %w[list info run start stop kill restart cleanup] named_args %w[list info run start stop kill restart cleanup]
@ -123,9 +124,6 @@ module Homebrew
] ]
if file_commands.exclude?(subcommand) if file_commands.exclude?(subcommand)
raise UsageError, "The `#{subcommand}` subcommand does not accept the `--file=` argument!" raise UsageError, "The `#{subcommand}` subcommand does not accept the `--file=` argument!"
elsif args.all?
raise UsageError,
"The `#{subcommand}` subcommand does not accept the `--all` and `--file=` arguments at the same time!"
end end
end end

View File

@ -1909,9 +1909,9 @@ _brew_search() {
# brew services # brew services
_brew_services() { _brew_services() {
_arguments \ _arguments \
'--all[Run subcommand on all services]' \ '(--file)--all[Run subcommand on all services]' \
'--debug[Display any debugging information]' \ '--debug[Display any debugging information]' \
'--file[Use the service file from this location to `start` the service]' \ '(--all)--file[Use the service file from this location to `start` the service]' \
'--help[Show this message]' \ '--help[Show this message]' \
'--json[Output as JSON]' \ '--json[Output as JSON]' \
'--keep[When stopped, don'\''t unregister the service from launching at login (or boot)]' \ '--keep[When stopped, don'\''t unregister the service from launching at login (or boot)]' \

View File

@ -1411,26 +1411,26 @@ If `sudo` is passed, operate on `/Library/LaunchDaemons` or
`/usr/lib/systemd/system` (started at boot). Otherwise, operate on `/usr/lib/systemd/system` (started at boot). Otherwise, operate on
`~/Library/LaunchAgents` or `~/.config/systemd/user` (started at login). `~/Library/LaunchAgents` or `~/.config/systemd/user` (started at login).
\[`sudo`\] `brew services` \[`list`\] (`--json`) (`--debug`) \[`sudo`\] `brew services` \[`list`\] \[`--json`\] \[`--debug`\]
: List information about all managed services for the current user (or root). : List information about all managed services for the current user (or root).
Provides more output from Homebrew and `launchctl`(1) or `systemctl`(1) if run Provides more output from Homebrew and `launchctl`(1) or `systemctl`(1) if run
with `--debug`. with `--debug`.
\[`sudo`\] `brew services info` (*`formula`*\|`--all`\|`--json`) \[`sudo`\] `brew services info` (*`formula`*\|`--all`) \[`--json`\]
: List all managed services for the current user (or root). : List all managed services for the current user (or root).
\[`sudo`\] `brew services run` (*`formula`*\|`--all`\|`--file=`) \[`sudo`\] `brew services run` (*`formula`*\|`--all`) \[`--file=`\]
: Run the service *`formula`* without registering to launch at login (or boot). : Run the service *`formula`* without registering to launch at login (or boot).
\[`sudo`\] `brew services start` (*`formula`*\|`--all`\|`--file=`) \[`sudo`\] `brew services start` (*`formula`*\|`--all`) \[`--file=`\]
: Start the service *`formula`* immediately and register it to launch at login : Start the service *`formula`* immediately and register it to launch at login
(or boot). (or boot).
\[`sudo`\] `brew services stop` (`--keep`) (`--no-wait`\|`--max-wait=`) (*`formula`*\|`--all`) \[`sudo`\] `brew services stop` \[`--keep`\] \[`--no-wait`\|`--max-wait=`\] (*`formula`*\|`--all`)
: Stop the service *`formula`* immediately and unregister it from launching at : Stop the service *`formula`* immediately and unregister it from launching at
login (or boot), unless `--keep` is specified. login (or boot), unless `--keep` is specified.
@ -1440,7 +1440,7 @@ If `sudo` is passed, operate on `/Library/LaunchDaemons` or
: Stop the service *`formula`* immediately but keep it registered to launch at : Stop the service *`formula`* immediately but keep it registered to launch at
login (or boot). login (or boot).
\[`sudo`\] `brew services restart` (*`formula`*\|`--all`\|`--file=`) \[`sudo`\] `brew services restart` (*`formula`*\|`--all`) \[`--file=`\]
: Stop (if necessary) and start the service *`formula`* immediately and register : Stop (if necessary) and start the service *`formula`* immediately and register
it to launch at login (or boot). it to launch at login (or boot).
@ -1462,14 +1462,6 @@ If `sudo` is passed, operate on `/Library/LaunchDaemons` or
: Wait at most this many seconds for `stop` to finish stopping a service. : Wait at most this many seconds for `stop` to finish stopping a service.
Defaults to 60. Set this to zero (0) seconds to wait indefinitely. Defaults to 60. Set this to zero (0) seconds to wait indefinitely.
`--all`
: Run *`subcommand`* on all services.
`--json`
: Output as JSON.
`--no-wait` `--no-wait`
: Don't wait for `stop` to finish stopping the service. : Don't wait for `stop` to finish stopping the service.
@ -1478,6 +1470,14 @@ If `sudo` is passed, operate on `/Library/LaunchDaemons` or
: When stopped, don't unregister the service from launching at login (or boot). : When stopped, don't unregister the service from launching at login (or boot).
`--all`
: Run *`subcommand`* on all services.
`--json`
: Output as JSON.
### `setup-ruby` \[*`command`* ...\] ### `setup-ruby` \[*`command`* ...\]
Installs and configures Homebrew's Ruby. If `command` is passed, it will only Installs and configures Homebrew's Ruby. If `command` is passed, it will only

View File

@ -879,25 +879,25 @@ Manage background services with macOS\[u2019] \fBlaunchctl\fP(1) daemon manager
.P .P
If \fBsudo\fP is passed, operate on \fB/Library/LaunchDaemons\fP or \fB/usr/lib/systemd/system\fP (started at boot)\. Otherwise, operate on \fB~/Library/LaunchAgents\fP or \fB~/\.config/systemd/user\fP (started at login)\. If \fBsudo\fP is passed, operate on \fB/Library/LaunchDaemons\fP or \fB/usr/lib/systemd/system\fP (started at boot)\. Otherwise, operate on \fB~/Library/LaunchAgents\fP or \fB~/\.config/systemd/user\fP (started at login)\.
.TP .TP
[\fBsudo\fP] \fBbrew services\fP [\fBlist\fP] (\fB\-\-json\fP) (\fB\-\-debug\fP) [\fBsudo\fP] \fBbrew services\fP [\fBlist\fP] [\fB\-\-json\fP] [\fB\-\-debug\fP]
List information about all managed services for the current user (or root)\. Provides more output from Homebrew and \fBlaunchctl\fP(1) or \fBsystemctl\fP(1) if run with \fB\-\-debug\fP\&\. List information about all managed services for the current user (or root)\. Provides more output from Homebrew and \fBlaunchctl\fP(1) or \fBsystemctl\fP(1) if run with \fB\-\-debug\fP\&\.
.TP .TP
[\fBsudo\fP] \fBbrew services info\fP (\fIformula\fP|\fB\-\-all\fP|\fB\-\-json\fP) [\fBsudo\fP] \fBbrew services info\fP (\fIformula\fP|\fB\-\-all\fP) [\fB\-\-json\fP]
List all managed services for the current user (or root)\. List all managed services for the current user (or root)\.
.TP .TP
[\fBsudo\fP] \fBbrew services run\fP (\fIformula\fP|\fB\-\-all\fP|\fB\-\-file=\fP) [\fBsudo\fP] \fBbrew services run\fP (\fIformula\fP|\fB\-\-all\fP) [\fB\-\-file=\fP]
Run the service \fIformula\fP without registering to launch at login (or boot)\. Run the service \fIformula\fP without registering to launch at login (or boot)\.
.TP .TP
[\fBsudo\fP] \fBbrew services start\fP (\fIformula\fP|\fB\-\-all\fP|\fB\-\-file=\fP) [\fBsudo\fP] \fBbrew services start\fP (\fIformula\fP|\fB\-\-all\fP) [\fB\-\-file=\fP]
Start the service \fIformula\fP immediately and register it to launch at login (or boot)\. Start the service \fIformula\fP immediately and register it to launch at login (or boot)\.
.TP .TP
[\fBsudo\fP] \fBbrew services stop\fP (\fB\-\-keep\fP) (\fB\-\-no\-wait\fP|\fB\-\-max\-wait=\fP) (\fIformula\fP|\fB\-\-all\fP) [\fBsudo\fP] \fBbrew services stop\fP [\fB\-\-keep\fP] [\fB\-\-no\-wait\fP|\fB\-\-max\-wait=\fP] (\fIformula\fP|\fB\-\-all\fP)
Stop the service \fIformula\fP immediately and unregister it from launching at login (or boot), unless \fB\-\-keep\fP is specified\. Stop the service \fIformula\fP immediately and unregister it from launching at login (or boot), unless \fB\-\-keep\fP is specified\.
.TP .TP
[\fBsudo\fP] \fBbrew services kill\fP (\fIformula\fP|\fB\-\-all\fP) [\fBsudo\fP] \fBbrew services kill\fP (\fIformula\fP|\fB\-\-all\fP)
Stop the service \fIformula\fP immediately but keep it registered to launch at login (or boot)\. Stop the service \fIformula\fP immediately but keep it registered to launch at login (or boot)\.
.TP .TP
[\fBsudo\fP] \fBbrew services restart\fP (\fIformula\fP|\fB\-\-all\fP|\fB\-\-file=\fP) [\fBsudo\fP] \fBbrew services restart\fP (\fIformula\fP|\fB\-\-all\fP) [\fB\-\-file=\fP]
Stop (if necessary) and start the service \fIformula\fP immediately and register it to launch at login (or boot)\. Stop (if necessary) and start the service \fIformula\fP immediately and register it to launch at login (or boot)\.
.TP .TP
[\fBsudo\fP] \fBbrew services cleanup\fP [\fBsudo\fP] \fBbrew services cleanup\fP
@ -912,17 +912,17 @@ When run as root on macOS, run the service(s) as this user\.
\fB\-\-max\-wait\fP \fB\-\-max\-wait\fP
Wait at most this many seconds for \fBstop\fP to finish stopping a service\. Defaults to 60\. Set this to zero (0) seconds to wait indefinitely\. Wait at most this many seconds for \fBstop\fP to finish stopping a service\. Defaults to 60\. Set this to zero (0) seconds to wait indefinitely\.
.TP .TP
\fB\-\-all\fP
Run \fIsubcommand\fP on all services\.
.TP
\fB\-\-json\fP
Output as JSON\.
.TP
\fB\-\-no\-wait\fP \fB\-\-no\-wait\fP
Don\[u2019]t wait for \fBstop\fP to finish stopping the service\. Don\[u2019]t wait for \fBstop\fP to finish stopping the service\.
.TP .TP
\fB\-\-keep\fP \fB\-\-keep\fP
When stopped, don\[u2019]t unregister the service from launching at login (or boot)\. When stopped, don\[u2019]t unregister the service from launching at login (or boot)\.
.TP
\fB\-\-all\fP
Run \fIsubcommand\fP on all services\.
.TP
\fB\-\-json\fP
Output as JSON\.
.SS "\fBsetup\-ruby\fP \fR[\fIcommand\fP \.\.\.]" .SS "\fBsetup\-ruby\fP \fR[\fIcommand\fP \.\.\.]"
Installs and configures Homebrew\[u2019]s Ruby\. If \fBcommand\fP is passed, it will only run Bundler if necessary for that command\. Installs and configures Homebrew\[u2019]s Ruby\. If \fBcommand\fP is passed, it will only run Bundler if necessary for that command\.
.SS "\fBshellenv\fP \fR[\fIshell\fP \.\.\.]" .SS "\fBshellenv\fP \fR[\fIshell\fP \.\.\.]"