From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12556 invoked from network); 12 Jul 2005 14:56:29 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 12 Jul 2005 14:56:29 -0000 Received: (qmail 63254 invoked from network); 12 Jul 2005 14:56:22 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 12 Jul 2005 14:56:22 -0000 Received: (qmail 5518 invoked by alias); 12 Jul 2005 14:56:19 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 21449 Received: (qmail 5507 invoked from network); 12 Jul 2005 14:56:18 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 12 Jul 2005 14:56:18 -0000 Received: (qmail 62948 invoked from network); 12 Jul 2005 14:56:18 -0000 Received: from mail-ihug.icp-qv1-irony2.iinet.net.au (HELO ihug-mail.icp-qv1-irony2.iinet.net.au) (203.59.1.196) by a.mx.sunsite.dk with SMTP; 12 Jul 2005 14:56:10 -0000 Received: from 203-206-249-182.dyn.iinet.net.au (HELO localhost.localdomain) (203.206.249.182) by ihug-mail.icp-qv1-irony2.iinet.net.au with ESMTP; 12 Jul 2005 22:56:01 +0800 X-BrightmailFiltered: true X-Brightmail-Tracker: AAAAAA== X-IronPort-AV: i="3.93,283,1114963200"; d="scan'208"; a="16340138:sNHT16730060" Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.12.8/8.12.8) with ESMTP id j6CEniNa018814 for ; Wed, 13 Jul 2005 00:49:46 +1000 Received: (from doug@localhost) by localhost.localdomain (8.12.8/8.12.8/Submit) id j6CEncdT018807 for zsh-workers@sunsite.dk; Wed, 13 Jul 2005 00:49:38 +1000 X-Authentication-Warning: localhost.localdomain: doug set sender to dougkearns@gmail.com using -f Date: Wed, 13 Jul 2005 00:49:38 +1000 From: Doug Kearns To: zsh-workers@sunsite.dk Subject: Re: PATCH: completion for ruby env variables Message-ID: <20050712144938.GB12661@localhost.localdomain> Mail-Followup-To: zsh-workers@sunsite.dk References: <20050702121046.GA9557@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050702121046.GA9557@localhost.localdomain> User-Agent: Mutt/1.4i X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.6 required=6.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 On Sat, Jul 02, 2005 at 10:10:46PM +1000, Doug Kearns wrote: > This adds completion for RUBYOPT, RUBYPATH, and RUBYLIB Apparently only -[IdvwrK] are allowed to be specified by RUBYOPT. Regards, Doug Index: Completion/Unix/Command/_ruby =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_ruby,v retrieving revision 1.6 diff -u -r1.6 _ruby --- Completion/Unix/Command/_ruby 11 Jul 2005 10:21:57 -0000 1.6 +++ Completion/Unix/Command/_ruby 12 Jul 2005 14:42:56 -0000 @@ -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 @@ 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