about summary refs log tree commit diff
path: root/Completion/Unix/Command/_ruby
blob: cc55e4da7a42769707041833569f6b31dd649938 (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
#compdef ruby

# http://www.ruby-lang.org/

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

_arguments -C -s -S \
  '(1 * -)--version[print version]' \
  '-c[syntax check]' \
  '-w[verbose mode without printing version message at the beginning]' \
  '(-d --debug)'{-d,--debug}'[debug mode]' \
  '(1 * -)'{-h,--help}'[print help message]' \
  '-l[automatic line-ending processing]' \
  '(-n)-p[loop and print]' \
  '(-p)-n[loop]' \
  '-a[auto-split mode]' \
  '-s[switch parsing]' \
  '-0-[input record separator]:input record separator in octal:' \
  '-K-[specifies KANJI (Japanese) encoding]:KANJI encoding:((e\:EUC-JP s\:Shift_JIS u\:UTF-8 N\:None))' \
  '-F-[input field separator]:input field separator:' \
  '-i-[in-place-edit mode]:suffix for in-place-edit mode:(.bak)' \
  '*-I+[library directory]:library directory:_files -/' \
  '*-r+[require library]:library name:->library' \
  '-S[search ruby script in PATH]' \
  '(-v --verbose)'{-v,--verbose}'[verbose mode]' \
  '-x-[embedded script]:directory:_files -/' \
  '-C+[chdir]:directory:_files -/' \
  '(-y --yydebug)'{-y,--yydebug}'[compiler debug mode]' \
  '(1 * -)--copyright[copyright notice]' \
  '-T-[taint check]:taint level:({0..4})' \
  '(1)*-e+[ruby command]:ruby command:' \
  '(-)1:script file:_files -g \*.rb' \
  '*:script argument:_files' && return 0

case $state in
  library)
    dirs=($(_call_program directories $words[1] -e 'print\ \$:.join\(\"\\n\"\)'))
    _wanted directories expl library \
      _path_files -W dirs && return 0
  ;;
esac

return 1