mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-18 15:21:16 +02:00
21400: add completion for RUBYOPT, RUBYLIB and RUBYPATH env variables
This commit is contained in:
parent
ce16f63906
commit
198bd8f9e6
2 changed files with 30 additions and 8 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2005-07-03 Doug Kearns <djkea2@gus.gscit.monash.edu.au>
|
||||||
|
|
||||||
|
* 21400: Completion/Unix/Command/_ruby: add completion for RUBYOPT,
|
||||||
|
RUBYLIB and RUBYPATH env variables
|
||||||
|
|
||||||
2005-06-30 Doug Kearns <djkea2@gus.gscit.monash.edu.au>
|
2005-06-30 Doug Kearns <djkea2@gus.gscit.monash.edu.au>
|
||||||
|
|
||||||
* unposted: Completion/Unix/Command/_links: declare parameter vals
|
* unposted: Completion/Unix/Command/_links: declare parameter vals
|
||||||
|
|
|
@ -1,13 +1,30 @@
|
||||||
#compdef ruby
|
#compdef ruby -P -value-,RUBY(LIB|OPT|PATH),-default-
|
||||||
|
|
||||||
# ruby 1.8.0 (2003-08-14) [i686-linux]
|
# ruby 1.8.0 (2003-08-14) [i686-linux]
|
||||||
|
|
||||||
local expl curcontext="$curcontext" line state ret=1
|
local curcontext="$curcontext" state line expl ret=1
|
||||||
typeset -A opt_args
|
typeset -A opt_args
|
||||||
local dirs
|
|
||||||
|
local -a args
|
||||||
|
args=(
|
||||||
|
'(-)1:script file:->script'
|
||||||
|
'*::script argument: _normal'
|
||||||
|
)
|
||||||
|
|
||||||
|
case "$service" in
|
||||||
|
*RUBY(LIB|PATH)*)
|
||||||
|
_dir_list && return 0
|
||||||
|
;;
|
||||||
|
*RUBYOPT*)
|
||||||
|
compset -q
|
||||||
|
words=( fake "$words[@]" )
|
||||||
|
(( CURRENT++ ))
|
||||||
|
args=()
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
_arguments -C -s -S \
|
_arguments -C -s -S \
|
||||||
'-0-[specify record separator]:input record separator in octal (default\: \0):' \
|
'-0-[specify record separator]:input record separator in octal (default \0):' \
|
||||||
'-a[autosplit mode with -n or -p (splits $_ into $F)]' \
|
'-a[autosplit mode with -n or -p (splits $_ into $F)]' \
|
||||||
'-c[check syntax only]' \
|
'-c[check syntax only]' \
|
||||||
'-C+[cd to directory, before executing your script]:directory:_files -/' \
|
'-C+[cd to directory, before executing your script]:directory:_files -/' \
|
||||||
|
@ -23,20 +40,20 @@ _arguments -C -s -S \
|
||||||
'*-r+[require the library, before executing your script]:library name:->library' \
|
'*-r+[require the library, before executing your script]:library name:->library' \
|
||||||
'-s[enable some switch parsing for switches after script name]' \
|
'-s[enable some switch parsing for switches after script name]' \
|
||||||
'-S[look for the script using PATH environment variable]' \
|
'-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))' \
|
'-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]' \
|
'(-v --verbose)'{-v,--verbose}'[print version number, then turn on verbose mode]' \
|
||||||
'-w[turn warnings on for your script]' \
|
'-w[turn warnings on for your script]' \
|
||||||
'-W-[set warning level]:warning level (default\: 2):((0\:silent 1\:medium 2\:verbose))' \
|
'-W-[set warning level]:warning level (default 2):((0\:silent 1\:medium 2\:verbose))' \
|
||||||
'(-y --yydebug)'{-y,--yydebug}'[enable yacc debugging in the parser]' \
|
'(-y --yydebug)'{-y,--yydebug}'[enable yacc debugging in the parser]' \
|
||||||
'-x-[strip off text before #!ruby line and perhaps cd to directory]:directory:_files -/' \
|
'-x-[strip off text before #!ruby line and perhaps cd to directory]:directory:_files -/' \
|
||||||
'(1 * -)--copyright[print the copyright]' \
|
'(1 * -)--copyright[print the copyright]' \
|
||||||
'(1 * -)'{-h,--help}'[print help message]' \
|
'(1 * -)'{-h,--help}'[print help message]' \
|
||||||
'(1 * -)--version[print the version]' \
|
'(1 * -)--version[print the version]' \
|
||||||
'(-)1:script file:_files -g "*.rb(-.)"' \
|
"$args[@]" && ret=0
|
||||||
'*:script argument:_files' && ret=0
|
|
||||||
|
|
||||||
case $state in
|
case $state in
|
||||||
library)
|
library)
|
||||||
|
local -a dirs
|
||||||
dirs=($(_call_program directories $words[1] -e 'puts\ \$:'))
|
dirs=($(_call_program directories $words[1] -e 'puts\ \$:'))
|
||||||
_wanted directories expl library _path_files -W dirs && ret=0
|
_wanted directories expl library _path_files -W dirs && ret=0
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in a new issue