Diff
1diff --git a/plugins/brew/_brew b/plugins/brew/_brew
2index 1f24bd67b10576067d7dd8d1aa2bc299dfafe103..19cfb22cb1a584059d708ea2d7025965e3e2429f 100644
3--- a/plugins/brew/_brew
4+++ b/plugins/brew/_brew
5@@ -33,6 +33,10 @@ _brew_outdated_formulae() {
6 outdated_formulae=(`brew outdated`)
7 }
8
9+_brew_installed_services() {
10+ installed_services=(`brew services list | awk '{print $1}' | tail -n+2`)
11+}
12+
13 local -a _1st_arguments
14 _1st_arguments=(
15 'audit:check formulae for Homebrew coding style'
16@@ -64,6 +68,7 @@ _1st_arguments=(
17 'prune:remove dead links'
18 'remove:remove a formula'
19 'search:search for a formula (/regex/ or string)'
20+ 'services:manage services'
21 'switch:switch between different versions of a formula'
22 'tap:tap a new formula repository from GitHub, or list existing taps'
23 'tap-info:information about a tap'
24@@ -82,7 +87,7 @@ _1st_arguments=(
25 )
26
27 local expl
28-local -a formulae installed_formulae installed_taps official_taps outdated_formulae
29+local -a formulae installed_formulae installed_taps official_taps outdated_formulae installed_services
30
31 _arguments \
32 '(-v)-v[verbose]' \
33@@ -142,4 +147,28 @@ case "$words[1]" in
34 upgrade)
35 _brew_outdated_formulae
36 _wanted outdated_formulae expl 'outdated formulae' compadd -a outdated_formulae ;;
37+ services)
38+ _arguments -C \
39+ '1: :->command' \
40+ '2: :->service' && return 0
41+
42+ local -a commands
43+
44+ commands=(
45+ 'cleanup:Get rid of stale services and unused plists'
46+ 'list:List all services managed by brew services'
47+ 'restart:Gracefully restart selected service'
48+ 'start:Start selected service'
49+ 'stop:Stop selected service'
50+ )
51+
52+ case $state in
53+ command)
54+ _describe -t commands 'Action' commands
55+ ;;
56+ service)
57+ _brew_installed_services
58+ _describe -t subcommands 'Services' installed_services
59+ ;;
60+ esac
61 esac