diff options
author | Doug Kearns <dkearns@users.sourceforge.net> | 2005-07-12 15:10:42 +0000 |
---|---|---|
committer | Doug Kearns <dkearns@users.sourceforge.net> | 2005-07-12 15:10:42 +0000 |
commit | bbe1c9bd176dcc9f44ddb2158b441387aaf9c75f (patch) | |
tree | 0450cbfaa16507f859755187a6a0282178a92c1c | |
parent | f5e61d18b01a8eb4cd72d767304c494b774b503d (diff) | |
download | zsh-bbe1c9bd176dcc9f44ddb2158b441387aaf9c75f.tar.gz zsh-bbe1c9bd176dcc9f44ddb2158b441387aaf9c75f.tar.xz zsh-bbe1c9bd176dcc9f44ddb2158b441387aaf9c75f.zip |
21449: limit completed options available to RUBYOPT to -[IdvwrK]
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | Completion/Unix/Command/_ruby | 78 |
2 files changed, 48 insertions, 34 deletions
diff --git a/ChangeLog b/ChangeLog index b777afdeb..bd172e044 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2005-07-12 Doug Kearns <djkea2@gus.gscit.monash.edu.au> + * 21449: Completion/Unix/Command/_ruby: limit options available to + RUBYOPT env variable to -[IdvwrK]; include directories specified with + -I in the search path used to generate library matches + * 21446 (modified): Completion/Unix/Command/_rake: generate targets for rakefiles in parent directories and those specified with -f; include directories specified with -I in the search path used to generate diff --git a/Completion/Unix/Command/_ruby b/Completion/Unix/Command/_ruby index 8a93be521..aef186c03 100644 --- a/Completion/Unix/Command/_ruby +++ b/Completion/Unix/Command/_ruby @@ -1,16 +1,45 @@ #compdef ruby -P -value-,RUBY(LIB|OPT|PATH),-default- -# ruby 1.8.0 (2003-08-14) [i686-linux] +# ruby 1.8.2 (2004-12-25) [i686-linux] local curcontext="$curcontext" state line expl ret=1 typeset -A opt_args -local -a args +local -a args opts + args=( '(-)1:script file:_files -g "*.rb(-.)"' '*::script argument: _normal' ) +opts=( + '-0-[specify record separator]:input record separator in octal (default \0):' + '-a[autosplit mode with -n or -p (splits $_ into $F)]' + '-c[check syntax only]' + '-C+[cd to directory, before executing your script]:directory:_files -/' + '(-d --debug)'{-d,--debug}'[set debugging flags (set $DEBUG to true)]' + "(1)*-e+[one line of script (several -e's allowed, omit program file)]:one line of script:" + '-F-[split() pattern for autosplit (-a)]:input field separator:' + '-i-[edit ARGV files in place (make backup if extension supplied)]:suffix for in-place-edit mode:(.bak)' + '*-I+[specify $LOAD_PATH directory (may be used more than once)]:library directory:_files -/' + '-K-[specifies KANJI (Japanese) code-set]:KANJI encoding:((e\:EUC-JP s\:Shift_JIS u\:UTF-8 N\:None))' + "-l[assume 'while gets(); ... end' loop around your script]" + "(-p)-n[assume 'while gets(); ... end' loop around your script]" + '(-n)-p[assume loop like -n but print line also like sed]' + '*-r+[require the library, before executing your script]:library name:->library' + '-s[enable some switch parsing for switches after script name]' + '-S[look for the script using PATH environment variable]' + '-T-[turn on tainting checks]:taint level (default 0):((0\:strings\ from\ streams/environment/ARGV\ are\ tainted 1\:no\ dangerous\ operation\ by\ tainted\ value 2\:process/file\ operations\ prohibited 3\:all\ generated\ objects\ are\ tainted 4\:no\ global\ \(non-tainted\)\ variable\ modification/no\ direct\ output))' + '(-v --verbose)'{-v,--verbose}'[print version number, then turn on verbose mode]' + '-w[turn warnings on for your script]' + '-W-[set warning level]:warning level (default 2):((0\:silent 1\:medium 2\:verbose))' + '(-y --yydebug)'{-y,--yydebug}'[enable yacc debugging in the parser]' + '-x-[strip off text before #!ruby line and perhaps cd to directory]:directory:_files -/' + '(1 * -)--copyright[print the copyright]' + '(1 * -)'{-h,--help}'[print help message]' + '(1 * -)--version[print the version]' +) + case "$service" in *RUBY(LIB|PATH)*) _dir_list && return 0 @@ -19,43 +48,24 @@ case "$service" in compset -q words=( fake "$words[@]" ) (( CURRENT++ )) - args=() + _arguments -C -s : "${(@M)opts:#*-[IdvwrK](|[-+])\[*}" && ret=0 + ;; + ruby) + _arguments -C -s -S : "$opts[@]" "$args[@]" && ret=0 ;; esac -_arguments -C -s -S \ - '-0-[specify record separator]:input record separator in octal (default \0):' \ - '-a[autosplit mode with -n or -p (splits $_ into $F)]' \ - '-c[check syntax only]' \ - '-C+[cd to directory, before executing your script]:directory:_files -/' \ - '(-d --debug)'{-d,--debug}'[set debugging flags (set $DEBUG to true)]' \ - "(1)*-e+[one line of script (several -e's allowed, omit program file)]:one line of script:" \ - '-F-[split() pattern for autosplit (-a)]:input field separator:' \ - '-i-[edit ARGV files in place (make backup if extension supplied)]:suffix for in-place-edit mode:(.bak)' \ - '*-I+[specify $LOAD_PATH directory (may be used more than once)]:library directory:_files -/' \ - '-K-[specifies KANJI (Japanese) code-set]:KANJI encoding:((e\:EUC-JP s\:Shift_JIS u\:UTF-8 N\:None))' \ - "-l[assume 'while gets(); ... end' loop around your script]" \ - "(-p)-n[assume 'while gets(); ... end' loop around your script]" \ - '(-n)-p[assume loop like -n but print line also like sed]' \ - '*-r+[require the library, before executing your script]:library name:->library' \ - '-s[enable some switch parsing for switches after script name]' \ - '-S[look for the script using PATH environment variable]' \ - '-T-[turn on tainting checks]:taint level (default 0):((0\:strings\ from\ streams/environment/ARGV\ are\ tainted 1\:no\ dangerous\ operation\ by\ tainted\ value 2\:process/file\ operations\ prohibited 3\:all\ generated\ objects\ are\ tainted 4\:no\ global\ \(non-tainted\)\ variable\ modification/no\ direct\ output))' \ - '(-v --verbose)'{-v,--verbose}'[print version number, then turn on verbose mode]' \ - '-w[turn warnings on for your script]' \ - '-W-[set warning level]:warning level (default 2):((0\:silent 1\:medium 2\:verbose))' \ - '(-y --yydebug)'{-y,--yydebug}'[enable yacc debugging in the parser]' \ - '-x-[strip off text before #!ruby line and perhaps cd to directory]:directory:_files -/' \ - '(1 * -)--copyright[print the copyright]' \ - '(1 * -)'{-h,--help}'[print help message]' \ - '(1 * -)--version[print the version]' \ - "$args[@]" && ret=0 - -case $state in +case "$state" in library) local -a dirs - dirs=($(_call_program directories $words[1] -e 'puts\ \$:')) - _wanted directories expl library _path_files -W dirs && ret=0 + local cmd + if [[ "$service" = *RUBYOPT* ]]; then + cmd=ruby + else + cmd=$words[1] + fi + dirs=( $(_call_program directories $cmd -e 'puts\ \$:' 2>/dev/null) ${(s.:.)opt_args[-I]} ) + _wanted libraries expl library _path_files -W dirs && ret=0 ;; esac |