summaryrefslogtreecommitdiff
path: root/shell/zsh-completion
blob: 502044c6bdaa81a93cc1fd8c45f24a077e45c38a (plain)
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
#compdef asp

_asp_command() {
  local -a _asp_cmds
  _asp_cmds=(
      'checkout'
      'difflog'
      'export'
      'gc'
      'disk-usage'
      'help'
      'list-all'
      'list-arches'
      'list-local'
      'list-repos'
      'log'
      'shortlog'
      'show'
      'update'
      'untrack'
      )

if (( CURRENT == 1 )); then
  _describe -t commands 'asp command' _asp_cmds || compadd "$@"
else
  local curcontext="$curcontext"
  cmd="${${_asp_cmds[(r)$words[1]:*]%%:*}}"
  if (( $#cmd )); then
    if (( $+functions[_asp_$cmd] )); then
      _asp_$cmd
    else
      _message "no more options"
    fi
  else
    _message "unknown asp command: $words[1]"
  fi
fi
}

_arguments \
  '-a[architecture]' \
  '-f[overwrite files]' \
  '-h[print help and exit]' \
  '-V[print version and exit]' \
  '*::asp command:_asp_command'

# vim: set et sw=2 ts=2 ft=zsh :