diff --git a/completions/bash/brew b/completions/bash/brew index 0bba26ebb5..80ed6b3dab 100644 --- a/completions/bash/brew +++ b/completions/bash/brew @@ -2286,6 +2286,28 @@ _brew_search() { esac } +_brew_services() { + local cur="${COMP_WORDS[COMP_CWORD]}" + case "${cur}" in + -*) + __brewcomp " + --all + --debug + --file + --help + --json + --max-wait + --no-wait + --quiet + --sudo-service-user + --verbose + " + return + ;; + *) ;; + esac +} + _brew_setup_ruby() { local cur="${COMP_WORDS[COMP_CWORD]}" case "${cur}" in @@ -3130,6 +3152,7 @@ _brew() { ruby) _brew_ruby ;; rubydoc) _brew_rubydoc ;; search) _brew_search ;; + services) _brew_services ;; setup-ruby) _brew_setup_ruby ;; sh) _brew_sh ;; shellenv) _brew_shellenv ;; diff --git a/completions/fish/brew.fish b/completions/fish/brew.fish index 5dc8a97696..77769c2d84 100644 --- a/completions/fish/brew.fish +++ b/completions/fish/brew.fish @@ -563,7 +563,7 @@ __fish_brew_complete_arg 'contributions' -l debug -d 'Display any debugging info __fish_brew_complete_arg 'contributions' -l from -d 'Date (ISO-8601 format) to start searching contributions. Omitting this flag searches the last year' __fish_brew_complete_arg 'contributions' -l help -d 'Show this message' __fish_brew_complete_arg 'contributions' -l quiet -d 'Make some output more quiet' -__fish_brew_complete_arg 'contributions' -l repositories -d 'Specify a comma-separated list of repositories to search. Supported repositories: `brew`, `core`, `cask`, `bundle`, `command-not-found`, `test-bot` and `services`. Omitting this flag, or specifying `--repositories=primary`, searches only the main repositories: brew,core,cask. Specifying `--repositories=all`, searches all repositories. ' +__fish_brew_complete_arg 'contributions' -l repositories -d 'Specify a comma-separated list of repositories to search. Supported repositories: `brew`, `core`, `cask`, `bundle`, `command-not-found` and `test-bot`. Omitting this flag, or specifying `--repositories=primary`, searches only the main repositories: brew,core,cask. Specifying `--repositories=all`, searches all repositories. ' __fish_brew_complete_arg 'contributions' -l to -d 'Date (ISO-8601 format) to stop searching contributions' __fish_brew_complete_arg 'contributions' -l user -d 'Specify a comma-separated list of GitHub usernames or email addresses to find contributions from. Omitting this flag searches maintainers' __fish_brew_complete_arg 'contributions' -l verbose -d 'Make some output more verbose' @@ -1499,6 +1499,19 @@ __fish_brew_complete_arg 'search' -l ubuntu -d 'Search for text in the given dat __fish_brew_complete_arg 'search' -l verbose -d 'Make some output more verbose' +__fish_brew_complete_cmd 'services' 'Manage background services with macOS\' `launchctl`(1) daemon manager or Linux\'s `systemctl`(1) service manager' +__fish_brew_complete_arg 'services' -l all -d 'Run subcommand on all services' +__fish_brew_complete_arg 'services' -l debug -d 'Display any debugging information' +__fish_brew_complete_arg 'services' -l file -d 'Use the service file from this location to `start` the service' +__fish_brew_complete_arg 'services' -l help -d 'Show this message' +__fish_brew_complete_arg 'services' -l json -d 'Output as JSON' +__fish_brew_complete_arg 'services' -l max-wait -d 'Wait at most this many seconds for `stop` to finish stopping a service. Omit this flag or set this to zero (0) seconds to wait indefinitely' +__fish_brew_complete_arg 'services' -l no-wait -d 'Don\'t wait for `stop` to finish stopping the service' +__fish_brew_complete_arg 'services' -l quiet -d 'Make some output more quiet' +__fish_brew_complete_arg 'services' -l sudo-service-user -d 'When run as root on macOS, run the service(s) as this user' +__fish_brew_complete_arg 'services' -l verbose -d 'Make some output more verbose' + + __fish_brew_complete_cmd 'setup-ruby' 'Installs and configures Homebrew\'s Ruby' __fish_brew_complete_arg 'setup-ruby' -l debug -d 'Display any debugging information' __fish_brew_complete_arg 'setup-ruby' -l help -d 'Show this message' diff --git a/completions/internal_commands_list.txt b/completions/internal_commands_list.txt index 3711dc41ac..b014662221 100644 --- a/completions/internal_commands_list.txt +++ b/completions/internal_commands_list.txt @@ -91,6 +91,7 @@ rubocop ruby rubydoc search +services setup-ruby sh shellenv diff --git a/completions/zsh/_brew b/completions/zsh/_brew index 1adde7deeb..055238afe1 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -211,6 +211,7 @@ __brew_internal_commands() { 'ruby:Run a Ruby instance with Homebrew'\''s libraries loaded' 'rubydoc:Generate Homebrew'\''s RubyDoc documentation' 'search:Perform a substring search of cask tokens and formula names for text' + 'services:Manage background services with macOS'\'' `launchctl`(1) daemon manager or Linux'\''s `systemctl`(1) service manager' 'setup-ruby:Installs and configures Homebrew'\''s Ruby' 'sh:Enter an interactive shell for Homebrew'\''s build environment' 'shellenv:Valid shells: bash|csh|fish|pwsh|sh|tcsh|zsh Print export statements' @@ -730,7 +731,7 @@ _brew_contributions() { '--from[Date (ISO-8601 format) to start searching contributions. Omitting this flag searches the last year]' \ '--help[Show this message]' \ '--quiet[Make some output more quiet]' \ - '--repositories[Specify a comma-separated list of repositories to search. Supported repositories: `brew`, `core`, `cask`, `bundle`, `command-not-found`, `test-bot` and `services`. Omitting this flag, or specifying `--repositories=primary`, searches only the main repositories: brew,core,cask. Specifying `--repositories=all`, searches all repositories. ]' \ + '--repositories[Specify a comma-separated list of repositories to search. Supported repositories: `brew`, `core`, `cask`, `bundle`, `command-not-found` and `test-bot`. Omitting this flag, or specifying `--repositories=primary`, searches only the main repositories: brew,core,cask. Specifying `--repositories=all`, searches all repositories. ]' \ '--to[Date (ISO-8601 format) to stop searching contributions]' \ '--user[Specify a comma-separated list of GitHub usernames or email addresses to find contributions from. Omitting this flag searches maintainers]' \ '--verbose[Make some output more verbose]' @@ -1853,6 +1854,21 @@ _brew_search() { '--verbose[Make some output more verbose]' } +# brew services +_brew_services() { + _arguments \ + '--all[Run subcommand on all services]' \ + '--debug[Display any debugging information]' \ + '--file[Use the service file from this location to `start` the service]' \ + '--help[Show this message]' \ + '--json[Output as JSON]' \ + '(--no-wait)--max-wait[Wait at most this many seconds for `stop` to finish stopping a service. Omit this flag or set this to zero (0) seconds to wait indefinitely]' \ + '(--max-wait)--no-wait[Don'\''t wait for `stop` to finish stopping the service]' \ + '--quiet[Make some output more quiet]' \ + '--sudo-service-user[When run as root on macOS, run the service(s) as this user]' \ + '--verbose[Make some output more verbose]' +} + # brew setup-ruby _brew_setup_ruby() { _arguments \ diff --git a/docs/Manpage.md b/docs/Manpage.md index 18aa335e79..493be78489 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -1183,6 +1183,78 @@ Perform a substring search of cask tokens and formula names for *`text`*. If : Search for *`text`* in the given database. +### `services` \[*`subcommand`*\] + +Manage background services with macOS' `launchctl`(1) daemon manager or Linux's +`systemctl`(1) service manager. + +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`) + +: 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`) + +: List all managed services for the current user (or root). + +\[`sudo`\] `brew services run` (*`formula`*\|`--all`) + +: Run the service *`formula`* without registering to launch at login (or boot). + +\[`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` (*`formula`*\|`--all`) + +: Stop the service *`formula`* immediately and unregister it from launching at + login (or boot). + +\[`sudo`\] `brew services kill` (*`formula`*\|`--all`) + +: Stop the service *`formula`* immediately but keep it registered to launch at + login (or boot). + +\[`sudo`\] `brew services restart` (*`formula`*\|`--all`) + +: Stop (if necessary) and start the service *`formula`* immediately and register + it to launch at login (or boot). + +\[`sudo`\] `brew services cleanup` + +: Remove all unused services. + +`--file` + +: Use the service file from this location to `start` the service. + +`--sudo-service-user` + +: When run as root on macOS, run the service(s) as this user. + +`--max-wait` + +: Wait at most this many seconds for `stop` to finish stopping a service. Omit + this flag or 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. + ### `setup-ruby` \[*`command`* ...\] Installs and configures Homebrew's Ruby. If `command` is passed, it will only @@ -2094,10 +2166,10 @@ Summarise contributions to Homebrew repositories. `--repositories` : Specify a comma-separated list of repositories to search. Supported - repositories: `brew`, `core`, `cask`, `bundle`, `command-not-found`, - `test-bot` and `services`. Omitting this flag, or specifying - `--repositories=primary`, searches only the main repositories: brew,core,cask. - Specifying `--repositories=all`, searches all repositories. + repositories: `brew`, `core`, `cask`, `bundle`, `command-not-found` and + `test-bot`. Omitting this flag, or specifying `--repositories=primary`, + searches only the main repositories: brew,core,cask. Specifying + `--repositories=all`, searches all repositories. `--from` @@ -3391,78 +3463,6 @@ flags which will help with finding keg-only dependencies like `openssl`, Print instructions for setting up the command-not-found hook for your shell. If the output is not to a tty, print the appropriate handler script for your shell. -### `services` \[*`subcommand`*\] - -Manage background services with macOS' `launchctl`(1) daemon manager or Linux's -`systemctl`(1) service manager. - -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`) - -: 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`) - -: List all managed services for the current user (or root). - -\[`sudo`\] `brew services run` (*`formula`*\|`--all`) - -: Run the service *`formula`* without registering to launch at login (or boot). - -\[`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` (*`formula`*\|`--all`) - -: Stop the service *`formula`* immediately and unregister it from launching at - login (or boot). - -\[`sudo`\] `brew services kill` (*`formula`*\|`--all`) - -: Stop the service *`formula`* immediately but keep it registered to launch at - login (or boot). - -\[`sudo`\] `brew services restart` (*`formula`*\|`--all`) - -: Stop (if necessary) and start the service *`formula`* immediately and register - it to launch at login (or boot). - -\[`sudo`\] `brew services cleanup` - -: Remove all unused services. - -`--file` - -: Use the service file from this location to `start` the service. - -`--sudo-service-user` - -: When run as root on macOS, run the service(s) as this user. - -`--max-wait` - -: Wait at most this many seconds for `stop` to finish stopping a service. Omit - this flag or 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. - ### `test-bot` \[*`options`*\] \[*`formula`*\] Tests the full lifecycle of a Homebrew change to a tap (Git repository). For diff --git a/manpages/brew.1 b/manpages/brew.1 index 63621a6fc0..94c04531f4 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -745,6 +745,52 @@ Search for \fItext\fP in the given database\. .TP \fB\-\-ubuntu\fP Search for \fItext\fP in the given database\. +.SS "\fBservices\fP \fR[\fIsubcommand\fP]" +Manage background services with macOS\[u2019] \fBlaunchctl\fP(1) daemon manager or Linux\[u2019]s \fBsystemctl\fP(1) service 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) +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) +List all managed services for the current user (or root)\. +.TP +[\fBsudo\fP] \fBbrew services run\fP (\fIformula\fP|\fB\-\-all\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) +Start the service \fIformula\fP immediately and register it to launch at login (or boot)\. +.TP +[\fBsudo\fP] \fBbrew services stop\fP (\fIformula\fP|\fB\-\-all\fP) +Stop the service \fIformula\fP immediately and unregister it from launching at login (or boot)\. +.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) +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 +Remove all unused services\. +.TP +\fB\-\-file\fP +Use the service file from this location to \fBstart\fP the service\. +.TP +\fB\-\-sudo\-service\-user\fP +When run as root on macOS, run the service(s) as this user\. +.TP +\fB\-\-max\-wait\fP +Wait at most this many seconds for \fBstop\fP to finish stopping a service\. Omit this flag or 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\. .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 \.\.\.]" @@ -1326,7 +1372,7 @@ Treat all named arguments as casks\. Summarise contributions to Homebrew repositories\. .TP \fB\-\-repositories\fP -Specify a comma\-separated list of repositories to search\. Supported repositories: \fBbrew\fP, \fBcore\fP, \fBcask\fP, \fBbundle\fP, \fBcommand\-not\-found\fP, \fBtest\-bot\fP and \fBservices\fP\&\. Omitting this flag, or specifying \fB\-\-repositories=primary\fP, searches only the main repositories: brew,core,cask\. Specifying \fB\-\-repositories=all\fP, searches all repositories\. +Specify a comma\-separated list of repositories to search\. Supported repositories: \fBbrew\fP, \fBcore\fP, \fBcask\fP, \fBbundle\fP, \fBcommand\-not\-found\fP and \fBtest\-bot\fP\&\. Omitting this flag, or specifying \fB\-\-repositories=primary\fP, searches only the main repositories: brew,core,cask\. Specifying \fB\-\-repositories=all\fP, searches all repositories\. .TP \fB\-\-from\fP Date (ISO\-8601 format) to start searching contributions\. Omitting this flag searches the last year\. @@ -2173,52 +2219,6 @@ Run \fBinstall\fP before continuing to other operations e\.g\. \fBexec\fP\&\. \fBcleanup\fP casks using the \fBzap\fP command instead of \fBuninstall\fP\&\. .SS "\fBcommand\-not\-found\-init\fP" Print instructions for setting up the command\-not\-found hook for your shell\. If the output is not to a tty, print the appropriate handler script for your shell\. -.SS "\fBservices\fP \fR[\fIsubcommand\fP]" -Manage background services with macOS\[u2019] \fBlaunchctl\fP(1) daemon manager or Linux\[u2019]s \fBsystemctl\fP(1) service 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) -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) -List all managed services for the current user (or root)\. -.TP -[\fBsudo\fP] \fBbrew services run\fP (\fIformula\fP|\fB\-\-all\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) -Start the service \fIformula\fP immediately and register it to launch at login (or boot)\. -.TP -[\fBsudo\fP] \fBbrew services stop\fP (\fIformula\fP|\fB\-\-all\fP) -Stop the service \fIformula\fP immediately and unregister it from launching at login (or boot)\. -.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) -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 -Remove all unused services\. -.TP -\fB\-\-file\fP -Use the service file from this location to \fBstart\fP the service\. -.TP -\fB\-\-sudo\-service\-user\fP -When run as root on macOS, run the service(s) as this user\. -.TP -\fB\-\-max\-wait\fP -Wait at most this many seconds for \fBstop\fP to finish stopping a service\. Omit this flag or 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\. .SS "\fBtest\-bot\fP \fR[\fIoptions\fP] \fR[\fIformula\fP]" Tests the full lifecycle of a Homebrew change to a tap (Git repository)\. For example, for a GitHub Actions pull request that changes a formula \fBbrew test\-bot\fP will ensure the system is cleaned and set up to test the formula, install the formula, run various tests and checks on it, bottle (package) the binaries and test formulae that depend on it to ensure they aren\[u2019]t broken by these changes\. .P