about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorDoug Kearns <dkearns@users.sourceforge.net>2003-03-06 03:47:43 +0000
committerDoug Kearns <dkearns@users.sourceforge.net>2003-03-06 03:47:43 +0000
commit1c300357f50b3786b3086b6d729bdef1abac7e08 (patch)
tree0224948f588f02633e55900fb75f4c3239c9adb0 /Completion
parent5660eb86ac16a0bb6d7f14d0026015f90bfa5c45 (diff)
downloadzsh-1c300357f50b3786b3086b6d729bdef1abac7e08.tar.gz
zsh-1c300357f50b3786b3086b6d729bdef1abac7e08.tar.xz
zsh-1c300357f50b3786b3086b6d729bdef1abac7e08.zip
18314: general improvements to ruby completion
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Unix/Command/_ruby40
1 files changed, 18 insertions, 22 deletions
diff --git a/Completion/Unix/Command/_ruby b/Completion/Unix/Command/_ruby
index b079253ee..cc55e4da7 100644
--- a/Completion/Unix/Command/_ruby
+++ b/Completion/Unix/Command/_ruby
@@ -1,49 +1,45 @@
 #compdef ruby
 
-# completion function for Ruby.
 # http://www.ruby-lang.org/
 
 local expl curcontext="$curcontext" line state
 typeset -A opt_args
 local dirs
 
-_arguments -C -s \
-  '--version[print version]' \
+_arguments -C -s -S \
+  '(1 * -)--version[print version]' \
   '-c[syntax check]' \
   '-w[verbose mode without printing version message at the beginning]' \
-  '(-d)--debug[debug mode]' \
-  '(--debug)-d[debug mode]' \
-  '(-h)--help[print help message]' \
-  '(--help)-h[print help message]' \
+  '(-d --debug)'{-d,--debug}'[debug mode]' \
+  '(1 * -)'{-h,--help}'[print help message]' \
   '-l[automatic line-ending processing]' \
-  '-p[loop and print]' \
-  '-n[loop]' \
+  '(-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' \
+  '*-I+[library directory]:library directory:_files -/' \
+  '*-r+[require library]:library name:->library' \
   '-S[search ruby script in PATH]' \
-  '(--verbose)-v[verbose mode]' \
-  '(-v)--verbose[verbose mode]' \
+  '(-v --verbose)'{-v,--verbose}'[verbose mode]' \
   '-x-[embedded script]:directory:_files -/' \
   '-C+[chdir]:directory:_files -/' \
-  '(--yydebug)-y[compiler debug mode]' \
-  '(-y)--yydebug[compiler debug mode]' \
-  '--copyright[copyright notice]' \
-  '-T-[taint check]:taint level:' \
-  '(1)-e+[ruby command]:ruby command:' \
-  ':script file:_files' \
-  ':script argument:_files' && return 0
+  '(-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
+      _path_files -W dirs && return 0
   ;;
 esac
-  
+
+return 1