summary refs log tree commit diff
path: root/Completion/Unix/Command/_rake
blob: 72e731b22d4b799b2cc3d44fe048ca2eae12e749 (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
#compdef rake

# rake, version 0.6.0

local curcontext="$curcontext" state line expl ret=1
typeset -A opt_args

_arguments -C -s -S \
  '(--classic-namespace -C)'{--classic-namespace,-C}'[put Task and FileTask in the top level namespace]' \
  '(--dry-run -n)'{--dry-run,-n}'[do a dry run without executing actions]' \
  '(- *)'{--help,-H}'[display help information]' \
  \*{--libdir,-I}'[include specified directory in the search path for required modules]:library directory:_files -/' \
  '(--nosearch -N)'{--nosearch,-N}'[do not search parent directories for the Rakefile]' \
  '(- *)'{--prereqs,-P}'[display the tasks and prerequisites, then exit]' \
  '(--quiet -q --silent -s --verbose -v)'{--quiet,-q}'[do not log messages to standard output]' \
  '(--rakefile -f)'{--rakefile,-f}'[use specified file as the rakefile]:rake file:_files' \
  \*{--require,-r}'[require specified module before executing rakefile]:library:->library' \
  '(--quiet -q --silent -s --verbose -v)'{--silent,-s}"[like --quiet, but also suppresses the 'in directory' announcement]" \
  '(- *)'{--tasks,-T}'[display the tasks and dependencies, then exit]' \
  '(--trace -t)'{--trace,-t}'[turn on invoke/execute tracing, enable full backtrace]' \
  '(- *)'{--usage,-h}'[display usage information]' \
  '(--quiet -q --silent -s --verbose -v)'{--verbose,-v}'[log message to standard output (default)]' \
  '(- *)'{--version,-V}'[display version information]' \
  '*:target:->target' && ret=0

case "$state" in
  library)
    local -a dirs
    dirs=( $(_call_program directories ruby -e 'puts\ \$:' 2>/dev/null) ${(s.:.)opt_args[-I]} )
    _wanted libraries expl library _path_files -W dirs && ret=0
  ;;
  target)
    local -a targets
    targets=( ${${(f)"$(_call_program targets $words[1] -sT $opt_args[(I)(-N|--nosearch)] ${(kv)opt_args[(I)(-f|--rakefile)]} 2>/dev/null)"}/(#b)rake ([^ ]##) ##\# (*)/${${match[1]}//:/\\:}:${match[2]:l}} )
    if (( ! ${targets[(I)rake aborted!]} )) then
      _describe -t targets 'rake target' targets && ret=0
    else
      _message -e targets 'rake target'
    fi
  ;;
esac

return ret