@@ -25,27 +25,27 @@ class Services < AbstractCommand
2525 If `sudo` is passed, operate on `/Library/LaunchDaemons` or `/usr/lib/systemd/system` (started at boot).
2626 Otherwise, operate on `~/Library/LaunchAgents` or `~/.config/systemd/user` (started at login).
2727
28- [`sudo`] `brew services` [`list`] ( `--json`) ( `--debug`) :
28+ [`sudo`] `brew services` [`list`] [ `--json`] [ `--debug`] :
2929 List information about all managed services for the current user (or root).
3030 Provides more output from Homebrew and `launchctl`(1) or `systemctl`(1) if run with `--debug`.
3131
32- [`sudo`] `brew services info` (<formula>|`--all`| `--json`) :
32+ [`sudo`] `brew services info` (<formula>|`--all`) [ `--json`] :
3333 List all managed services for the current user (or root).
3434
35- [`sudo`] `brew services run` (<formula>|`--all`| `--file=`) :
35+ [`sudo`] `brew services run` (<formula>|`--all`) [ `--file=`] :
3636 Run the service <formula> without registering to launch at login (or boot).
3737
38- [`sudo`] `brew services start` (<formula>|`--all`| `--file=`) :
38+ [`sudo`] `brew services start` (<formula>|`--all`) [ `--file=`] :
3939 Start the service <formula> immediately and register it to launch at login (or boot).
4040
41- [`sudo`] `brew services stop` ( `--keep`) ( `--no-wait`|`--max-wait=`) (<formula>|`--all`):
41+ [`sudo`] `brew services stop` [ `--keep`] [ `--no-wait`|`--max-wait=`] (<formula>|`--all`):
4242 Stop the service <formula> immediately and unregister it from launching at login (or boot),
4343 unless `--keep` is specified.
4444
4545 [`sudo`] `brew services kill` (<formula>|`--all`):
4646 Stop the service <formula> immediately but keep it registered to launch at login (or boot).
4747
48- [`sudo`] `brew services restart` (<formula>|`--all`| `--file=`) :
48+ [`sudo`] `brew services restart` (<formula>|`--all`) [ `--file=`] :
4949 Stop (if necessary) and start the service <formula> immediately and register it to launch at login (or boot).
5050
5151 [`sudo`] `brew services cleanup`:
@@ -58,15 +58,16 @@ class Services < AbstractCommand
5858 flag "--max-wait=" ,
5959 description : "Wait at most this many seconds for `stop` to finish stopping a service. " \
6060 "Defaults to 60. Set this to zero (0) seconds to wait indefinitely."
61- switch "--all" ,
62- description : "Run <subcommand> on all services."
63- switch "--json" ,
64- description : "Output as JSON."
6561 switch "--no-wait" ,
6662 description : "Don't wait for `stop` to finish stopping the service."
6763 switch "--keep" ,
6864 description : "When stopped, don't unregister the service from launching at login (or boot)."
65+ switch "--all" ,
66+ description : "Run <subcommand> on all services."
67+ switch "--json" ,
68+ description : "Output as JSON."
6969
70+ conflicts "--all" , "--file"
7071 conflicts "--max-wait=" , "--no-wait"
7172
7273 named_args %w[ list info run start stop kill restart cleanup ]
@@ -112,7 +113,7 @@ def run
112113 ]
113114 if no_named_formula_commands . include? ( subcommand )
114115 raise UsageError , "The `#{ subcommand } ` subcommand does not accept a formula argument!" if formulae . present?
115- raise UsageError , "The `#{ subcommand } ` subcommand does not accept the --all argument!" if args . all?
116+ raise UsageError , "The `#{ subcommand } ` subcommand does not accept the ` --all` argument!" if args . all?
116117 end
117118
118119 if args . file
@@ -122,22 +123,22 @@ def run
122123 *Homebrew ::Services ::Commands ::Restart ::TRIGGERS ,
123124 ]
124125 if file_commands . exclude? ( subcommand )
125- raise UsageError , "The `#{ subcommand } ` subcommand does not accept the --file= argument!"
126- elsif args . all?
127- raise UsageError ,
128- "The `#{ subcommand } ` subcommand does not accept the --all and --file= arguments at the same time!"
126+ raise UsageError , "The `#{ subcommand } ` subcommand does not accept the `--file=` argument!"
129127 end
130128 end
131129
132130 unless Homebrew ::Services ::Commands ::Stop ::TRIGGERS . include? ( subcommand )
133- raise UsageError , "The `#{ subcommand } ` subcommand does not accept the --keep argument!" if args . keep?
134- raise UsageError , "The `#{ subcommand } ` subcommand does not accept the --no-wait argument!" if args . no_wait?
131+ raise UsageError , "The `#{ subcommand } ` subcommand does not accept the `--keep` argument!" if args . keep?
132+
133+ if args . no_wait?
134+ raise UsageError , "The `#{ subcommand } ` subcommand does not accept the `--no-wait` argument!"
135+ end
135136 if args . max_wait
136- raise UsageError , "The `#{ subcommand } ` subcommand does not accept the --max-wait= argument!"
137+ raise UsageError , "The `#{ subcommand } ` subcommand does not accept the ` --max-wait=` argument!"
137138 end
138139 end
139140
140- opoo "The --all argument overrides provided formula argument!" if formulae . present? && args . all?
141+ opoo "The ` --all` argument overrides provided formula argument!" if formulae . present? && args . all?
141142
142143 targets = if args . all?
143144 if subcommand == "start"
0 commit comments