diff --git a/Library/Homebrew/cmd/services.rb b/Library/Homebrew/cmd/services.rb index 398e01c169..21759424e1 100644 --- a/Library/Homebrew/cmd/services.rb +++ b/Library/Homebrew/cmd/services.rb @@ -25,27 +25,27 @@ module Homebrew 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). - [`sudo`] `brew services` [`list`] (`--json`) (`--debug`): + [`sudo`] `brew services` [`list`] [`--json`] [`--debug`]: 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`. - [`sudo`] `brew services info` (|`--all`|`--json`): + [`sudo`] `brew services info` (|`--all`) [`--json`]: List all managed services for the current user (or root). - [`sudo`] `brew services run` (|`--all`|`--file=`): + [`sudo`] `brew services run` (|`--all`) [`--file=`]: Run the service without registering to launch at login (or boot). - [`sudo`] `brew services start` (|`--all`|`--file=`): + [`sudo`] `brew services start` (|`--all`) [`--file=`]: Start the service immediately and register it to launch at login (or boot). - [`sudo`] `brew services stop` (`--keep`) (`--no-wait`|`--max-wait=`) (|`--all`): + [`sudo`] `brew services stop` [`--keep`] [`--no-wait`|`--max-wait=`] (|`--all`): Stop the service immediately and unregister it from launching at login (or boot), unless `--keep` is specified. [`sudo`] `brew services kill` (|`--all`): Stop the service immediately but keep it registered to launch at login (or boot). - [`sudo`] `brew services restart` (|`--all`|`--file=`): + [`sudo`] `brew services restart` (|`--all`) [`--file=`]: Stop (if necessary) and start the service immediately and register it to launch at login (or boot). [`sudo`] `brew services cleanup`: @@ -58,15 +58,16 @@ module Homebrew flag "--max-wait=", 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." - switch "--all", - description: "Run on all services." - switch "--json", - description: "Output as JSON." switch "--no-wait", description: "Don't wait for `stop` to finish stopping the service." switch "--keep", description: "When stopped, don't unregister the service from launching at login (or boot)." + switch "--all", + description: "Run on all services." + switch "--json", + description: "Output as JSON." + conflicts "--all", "--file" conflicts "--max-wait=", "--no-wait" named_args %w[list info run start stop kill restart cleanup] @@ -123,9 +124,6 @@ module Homebrew ] if file_commands.exclude?(subcommand) 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 diff --git a/completions/zsh/_brew b/completions/zsh/_brew index e0e7592fb9..ce88bff9d3 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -1909,9 +1909,9 @@ _brew_search() { # brew services _brew_services() { _arguments \ - '--all[Run subcommand on all services]' \ + '(--file)--all[Run subcommand on all services]' \ '--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]' \ '--json[Output as JSON]' \ '--keep[When stopped, don'\''t unregister the service from launching at login (or boot)]' \ diff --git a/docs/Manpage.md b/docs/Manpage.md index 11bf45a148..cabe08169f 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -1411,26 +1411,26 @@ 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). -\[`sudo`\] `brew services` \[`list`\] (`--json`) (`--debug`) +\[`sudo`\] `brew services` \[`list`\] \[`--json`\] \[`--debug`\] : 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`. -\[`sudo`\] `brew services info` (*`formula`*\|`--all`\|`--json`) +\[`sudo`\] `brew services info` (*`formula`*\|`--all`) \[`--json`\] : 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). -\[`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). -\[`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), 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 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). @@ -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. Defaults to 60. Set this to zero (0) seconds to wait indefinitely. -`--all` - -: Run *`subcommand`* on all services. - -`--json` - -: Output as JSON. - `--no-wait` : 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). +`--all` + +: Run *`subcommand`* on all services. + +`--json` + +: Output as JSON. + ### `setup-ruby` \[*`command`* ...\] Installs and configures Homebrew's Ruby. If `command` is passed, it will only diff --git a/manpages/brew.1 b/manpages/brew.1 index 03d5241e9b..d2fcf7697f 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -879,25 +879,25 @@ Manage background services with macOS\[u2019] \fBlaunchctl\fP(1) daemon manager .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)\. .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\&\. .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)\. .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)\. .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)\. .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\. .TP [\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)\. .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)\. .TP [\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 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 -\fB\-\-all\fP -Run \fIsubcommand\fP on all services\. -.TP -\fB\-\-json\fP -Output as JSON\. -.TP \fB\-\-no\-wait\fP Don\[u2019]t wait for \fBstop\fP to finish stopping the service\. .TP \fB\-\-keep\fP 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 \.\.\.]" 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 \.\.\.]"