From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17421 invoked from network); 15 Jun 2005 13:30:56 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 15 Jun 2005 13:30:56 -0000 Received: (qmail 69823 invoked from network); 15 Jun 2005 13:30:48 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 15 Jun 2005 13:30:48 -0000 Received: (qmail 8097 invoked by alias); 15 Jun 2005 13:30:45 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 21343 Received: (qmail 8087 invoked from network); 15 Jun 2005 13:30:45 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 15 Jun 2005 13:30:45 -0000 Received: (qmail 69527 invoked from network); 15 Jun 2005 13:30:45 -0000 Received: from grunt26.ihug.com.au (203.109.249.146) by a.mx.sunsite.dk with SMTP; 15 Jun 2005 13:30:40 -0000 Received: from 203-217-27-249.dyn.iinet.net.au (localhost.localdomain) [203.217.27.249] by grunt26.ihug.com.au with esmtp (Exim 3.35 #1 (Debian)) id 1DiXyT-0000wB-00; Wed, 15 Jun 2005 23:30:34 +1000 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.12.8/8.12.8) with ESMTP id j5FDP6va020840 for ; Wed, 15 Jun 2005 23:25:07 +1000 Received: (from doug@localhost) by localhost.localdomain (8.12.8/8.12.8/Submit) id j5FDP3Dh020838 for zsh-workers@sunsite.dk; Wed, 15 Jun 2005 23:25:03 +1000 X-Authentication-Warning: localhost.localdomain: doug set sender to dougkearns@gmail.com using -f Date: Wed, 15 Jun 2005 23:25:02 +1000 From: Doug Kearns To: zsh-workers@sunsite.dk Subject: PATCH: php completion update Message-ID: <20050615132502.GB4437@localhost.localdomain> Mail-Followup-To: zsh-workers@sunsite.dk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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, RCVD_IN_SORBS_WEB autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 This updates php cli completion for versions 4.3.x and 5.0.x and adds better directive and extension completions. Regards, Doug Index: Completion/Unix/Command/_php =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_php,v retrieving revision 1.1 diff -u -r1.1 _php --- Completion/Unix/Command/_php 16 Apr 2004 15:50:02 -0000 1.1 +++ Completion/Unix/Command/_php 15 Jun 2005 13:20:01 -0000 @@ -1,37 +1,67 @@ #compdef php -# PHP 4.3.6RC2 (cli) (built: Apr 9 2004 00:14:04) +# PHP 5.0.4 (cli) +# PHP 4.3.11 (cli) -local curcontext="$curcontext" line state +local curcontext="$curcontext" line state expl typeset -A opt_args -_arguments -S \ - {-a,--interactive}'[run interactively]' \ - {-c,--php-ini}'[look for php.ini file in the specified directory]:directory:_files -/' \ - {-n,--no-php-ini}'[no php.ini file will be used]' \ - {-d,--define}"[define INI entry]:configuration directive:->ini" \ - {-e,--profile-info}'[generate extended information for debugger/profiler]' \ - '(- *)'{-h,--help}'[display help information]' \ - '(- *)'{-i,--info}'[PHP information]' \ - '(-)'{-l,--syntax-check}'[syntax check only (lint)]' \ - '(- *)'{-m,--modules}'[show compiled in modules]' \ - '(1 -l --syntax-check -s --syntax-highlight -w --strip)'{-r,--run}'[run the specified PHP code without using script tags ]:PHP code:'\ - '(-)'{-s,--syntax-highlight}'[display colour syntax highlighted source]' \ - '(- *)'{-v,--version}'[display version information]' \ - '(-)'{-w,--strip}'[display source with stripped comments and whitespace]' \ - {-z,--zend-extension}'[load specified Zend extension]:extension file:_files' \ - '(-)1:PHP file:_files -g "*.php(-.)"' \ - '*:script argument:_files' && return +local -a args +local exclusions php_files=':PHP file:_files -g "*.php(-.)"' + +if _pick_variant php5=PHP\ 5 php4 --version; then + exclusions="-B --process-begin -R --process-code -F --process-file -E --process-end" + args=( + '(-B --process-begin -f --file -r --run 1)'{-B,--process-begin}'[run specified PHP code before processing input lines]:PHP code:' + '(-R --process-code -F --process-file -f --file -r --run 1)'{-R,--process-code}'[run specified PHP code for every input line]:PHP code:' + '(-F --process-file -R --process-code -f --file -r --run 1)'{-F,--process-file}'[parse and execute specified file for every input line]'$php_files + '(-E --process-end -f --file -r --run 1)'{-E,--process-end}'[run specified PHP code after processing all input lines]:PHP code:' + '(-H --hide-args)'{-H,--hide-args}'[hide any passed arguments from external tools]' + ) +fi + +args+=( + '(-a --interactive)'{-a,--interactive}'[run interactively]' + '(-c --php-ini -n --no-php-ini)'{-c,--php-ini}'[look for php.ini file in the specified directory]:INI file or directory:_files -g "*.ini(-.)"' + '(-c --php-ini -n --no-php-ini)'{-n,--no-php-ini}'[no php.ini file will be used]' + '(-d --define)'{-d,--define}'[define INI entry]:configuration directive:->directive' + '(-e --profile-info)'{-e,--profile-info}'[generate extended information for debugger/profiler]' + "(-f --file -r --run $exclusions 1)"{-f,--file}'[parse specified file]'$php_files + '(- 1 *)'{-h,--help}'[display help information]' + '(- 1 *)'{-i,--info}'[PHP information]' + '(- *)'{-l,--syntax-check}'[syntax check only (lint)]' + '(- 1 *)'{-m,--modules}'[show compiled in modules]' + "(-r --run -f --file $exclusions -l --syntax-check -s --syntax-highlight -w --strip 1)"{-r,--run}'[run the specified PHP code without using script tags ]:PHP code:'\ + '(- 1 *)'{-s,--syntax-highlight}'[display colour syntax highlighted source]' + '(- 1 *)'{-v,--version}'[display version information]' + '(- *)'{-w,--strip}'[display source with stripped comments and whitespace]' + '(-z --zend-extension)'{-z,--zend-extension}'[load specified Zend extension]:extension file:->extension' + '(-)1'$php_files + '(-)*::script argument: _normal' +) + +_arguments -C -s -S -A "-*" "$args[@]" && return 0 case $state in - ini) + directive) + local -a directives + local code='foreach (ini_get_all() as $k => $v) { echo "$k\n"; }' + directives=( $(_call_program directives $words[1] -r ${(q)code} 2>/dev/null) ) if compset -P '*='; then - _default + _default && return 0 else - _message -e configuration-directives 'configuration directive' + _wanted directives expl 'configuration directive' compadd -qS= -a directives && return 0 fi - ;; + ;; + extension) + local -a paths + if [[ -r /etc/ld.so.conf ]]; then + paths=( ${(f)"$(