aboutsummaryrefslogtreecommitdiffstats
path: root/src/_lunchy
blob: 652c18664296f856d343ce7c2a9b654b8d818b72 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#compdef lunchy
# ------------------------------------------------------------------------------
# Description
# -----------
#
#  Completion script for lunchy (https://github.com/mperham/lunchy).
#
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
#  * Blake Walters (https://github.com/markupboy)
#
# ------------------------------------------------------------------------------

local state line cmds ret=1

_arguments -C '1: :->cmds' '*: :->args'

case $state in
  cmds)
    local -a cmds
    cmds=(
      'ls:list available agents'
      'start:start an agent'
      'stop:stop an agent'
      'restart:restart an agent'
      'status:get the status of agent[s]'
      'install:install an agents plist file'
      'edit:edit an agent'
    )
    _describe -t commands 'lunchy command' cmds && ret=0
    ;;
  args)
    case $line[1] in
      (install)
        ;;
      (restart|stop)
        _values 'items' `lunchy status | awk '{print $3}' ` 2>/dev/null && ret=0
        ;;
      *)
        _values 'items' `lunchy ls` 2>/dev/null && ret=0
        ;;
    esac
    ;;
esac

return ret